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

Jetty 9 X-Forwarded-For Configuration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.17.3
    • 2.18.0
    • camel-jetty
    • 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>

      Attachments

        1. JettyHttpComponent9.java
          7 kB
          Remco Schoen
        2. JettyHttpComponent.java
          56 kB
          Remco Schoen

        Activity

          People

            acosentino Andrea Cosentino
            duvel Remco Schoen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: