Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Good morning!

I have nginx setup in front of jetty 6, which is running a GWT application. I am trying to forward the ip address, and all the answers I find on the internet tell me to do this:

proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP  $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

This works just fine, except that jetty's logs don't show the X-Real-IP, they show Also, jetty/GWT has for getThreadLocalRequest().getRemoteAddr(), although I can access the X-Real-IP to get the correct remote IP.

Any ideas how to get the correct remote ip for the jetty logs and also get getThreadLocalRequest().getRemoteAddr() to work correctly?


share|improve this question

1 Answer 1

up vote 1 down vote accepted

You should just add forwarded config to your connector in /etc/jetty.xml. Example:

<Call name="addConnector">
        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
           <Set name="forwarded">true</Set>

This should work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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