I am using a reverse proxy (Apache) in front of Jetty 6. Users connect to Apache with SSL, and Apache forwards some of the requests to Jetty over plain HTTP. I want Jetty to use secure session cookies.
One would think this would be the first thing anyone does after installing Jetty - but I'm having a hard time getting it to work.
I set up Jetty to use secure cookies as described in another stackoverflow question. However, Jetty refuses to use secure cookies - I assume it is because the connection from the reverse proxy is not SSL.
I tried to convince Jetty it is working on a request that came over SSL following a description at sonatype.com. That is, I added the following in Apache:
RequestHeader set X-Forwarded-Scheme "https"
and in /etc/jetty/jetty.xml:
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.rewrite.RewriteHandler">
<Set name="rules">
<Array type="org.mortbay.jetty.handler.rewrite.Rule">
<Item>
<New id="forwardedHttps"
class="org.mortbay.jetty.handler.rewrite.ForwardedSchemeHeaderRule">
<Set name="header">X-Forwarded-Scheme</Set>
<Set name="headerValue">https</Set>
<Set name="scheme">https</Set>
</New>
</Item>
</Array>
</Set>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
</Item>
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
</New>
</Set>
Still no secure cookies. Any suggestions?