2

Okay, so basically what I want to do is set up a reverse proxy to serve https pages on nginx and redirect them to Jetty using http. The problem is that the servlet actually requires https and redirects to https address once it sees that it was sent to http page.

Previously I had it all running under Jetty 7 by adding:

<Set name="forwarded">true</Set>

to jetty.xml for SelectChannelConnector and now that I decided to upgrade to Jetty 9 I can't seem to find any replacement for this config and I'm pretty sure there's no problem with my nginx setup as it used to work perfectly fine with Jetty 7.

Here's a part of my nginx config just to make things clearer what I've got there:

location / {
    proxy_pass http://127.0.0.1:8080;
    include /etc/nginx/proxy_params;
}

While here's my proxy_params file:

proxy_redirect   off;
proxy_set_header Host              $host;
proxy_set_header X-Real-IP         $remote_addr;
proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
2

It seems to be a fairly simple thing to achieve. One simply needs to uncomment the following part in /etc/jetty.xml:

<!-- Uncomment to enable handling of X-Forwarded- style headers
<Call name="addCustomizer">
  <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
</Call>
-->

so I was either blind or older version of Jetty 9 didn't have this option in such an obvious place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.