Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientInfo.getUpstreamAddress() does not return IP as set in X-Forwarded-For header #1341

Open
ebner opened this issue Mar 10, 2019 · 2 comments

Comments

@ebner
Copy link

ebner commented Mar 10, 2019

The application is executed in Tomcat 8 using the Servlet connector, behind an Apache HTTPD which is configured as reverse proxy. The reverse proxy sets the X-Forwarded-For header correctly, but the method request.getClientInfo().getUpstreamAddress() returns the IP of the proxy, and not the IP as specified by X-Forwarded-For.

The header can be accessed directly using request.getHeaders().getFirstValue("x-forwarded-for", true) on the very same request, so something seems to be broken in the convenience method ClientInfo.getUpstreamAddress().

I am calling getContext().getParameters().add("useForwardedForHeader", "true") in the Restlet's createInboundRoot() method, I don't know whether that's needed for the Servlet connector though.

The Restlet version in use is 2.3.12 on OpenJDK 1.8.0_191.

@cyberquarks

This comment has been minimized.

@flatlanderer
Copy link

@jlouvel Here's the block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants