Details
Description
The scheme is not set when the "forwarded" parameter is set to true. The 'hostAddress' can not contain the scheme information. For example, let us assume that there is a Front Server (reachable from outside via HTTPS) at front of Jetty running on another secured machine. If the Jetty is accessed via HTTP then there is no simple way to "forward" the scheme, too.
The workaround is to write another rewrite handler rule. The attachment contains such an implementation. The configuration of this handler is very easy. The following XML snippet demonstrates its usage:
<!-- Forward the scheme. -->
<Call name="addRule">
<Arg>
<New class="org.mortbay.jetty.handler.rewrite.SchemePatternRule"/>
<Set name="pattern">/*</Set>
<Set name="scheme">https</Set>
</New>
</Arg>
</Call>
Any thoughts on using an X-Forwarded-$x header?
One thing I see against my suggestion is that there doesn't seem to be a de-facto standard for this, unlike X-Forwarded-For, etc. Apache uses X-Forwarded-Ssl; Mongrel uses X-Forwarded-Proto. On the other hand, it would be consistent with how other forwarded information (X-Forwarded-Host/For/Server) is set on the request (in AbstractConnector)