Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345081

Summary: The NestedConnector#isConfidential always returns false
Product: [RT] Jetty Reporter: Hugues Malphettes <hmalphettes>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jetty-inbox
Version: 7.4.0   
Target Milestone: 7.2.x   
Hardware: All   
OS: All   
Whiteboard:

Description Hugues Malphettes CLA 2011-05-08 20:09:24 EDT
When running a servlet from inside the nested connector the method HttpServletRequest#isSecure() always returns false.
Comment 1 Hugues Malphettes CLA 2011-05-08 20:11:36 EDT
The suggested patch consists of doing what the SslChannelSelectConnector does:
Override the method isConfidential in the NestedConnector.

/**
     * In the case of the NesteConnector it is not clear that we can check the forwarded attribute.
     * We do something similar to what the Ssl*Connector does.
     * @see org.eclipse.jetty.server.Connector#isConfidential(org.eclipse.jetty.server.Request)
     * @see org.eclipse.jetty.server.ssl.SslSelectChannelConnector#isConfidential(org.eclipse.jetty.server.Request)
     */
    public boolean isConfidential(Request request)
    {
    	if (request.getScheme().equalsIgnoreCase(HttpSchemes.HTTPS))
    	{
	        final int confidentialPort = getConfidentialPort();
	        return confidentialPort == 0 || confidentialPort == request.getServerPort();
    	}
    	else
    	{
    		return false;
    	}
    }
Comment 2 Greg Wilkins CLA 2011-05-09 21:46:33 EDT
the connector is now setup in forwarded mode and inspects for the x-forwarded-for headers.  Also the outer request is consulted when setting the protocol.