Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10270

Jetty 9 X-Forwarded-For Configuration

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.17.3
    • Fix Version/s: 2.18.0
    • Component/s: camel-jetty
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      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>

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              duvel Remco Schoen

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment