restlet-framework-java
restlet-framework-java copied to clipboard
ClientInfo.getUpstreamAddress() does not return IP as set in X-Forwarded-For header
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.
@ebner you may be interested in joining the "Unofficial Restlet Community" https://gitter.im/restlet-framework/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link
@jlouvel Here's the block
In Restlet 3.0 we will be dropping support for Servlet to focus on deployment to cloud native architectures, microservices, service mesh, reducing the value of Servlet containers.