Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.17.3
-
None
-
Patch Available
-
Unknown
Description
My integration is behind a proxy and I would like access to the real ip of the client.
In the Jetty component documentation there is information how to do this in Jetty 8. This document still refers to the old JettyHttpComponent and not the new JettyHttpComponent8.
http://camel.apache.org/jetty.html - Obtaining X-Forwarded-For header with HttpServletRequest.getRemoteAddr()
In Jetty 9 it is done differently and they now use so called customizers:
http://www.eclipse.org/jetty/documentation/9.4.x/configuring-connectors.html#_proxy_load_balancer_connection_configuration
I got it to work by manually adding this line in JettyHttpComponent9.createConnectorJettyInternal:
httpConfig.addCustomizer(new org.eclipse.jetty.server.ForwardedRequestCustomizer());
I tried adding an extra parameter for this in the components, not sure if it is the right way.
My solution in the sping dsl:
<bean id="jetty" class="org.apache.camel.component.jetty9.JettyHttpComponent9">
<property name="useXForwardedForHeader" value="true"/>
</bean>