Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-5669

[GSS](7.0.z) proxy-address-forwarding has not effect when Host header is present

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.3.CR1, 7.0.3.GA
    • 7.0.1.GA
    • Undertow
    • None
    • Hide

      1. Set `proxy-address-forwarding="true"` on http-listener:
      2. Deploy jsp that logs out request.getServerName/getServerPort/etc.
      3. Make request with X-Forwarded-* headers present:

      # curl -H "X-Forwarded-Host:myhost" -H "X-Forwarded-Port: 80" http://localhost:8080/sample_proxynameport/hello.jsp
      request.getServerName() => localhost
      request.getServerPort() => 8080
      request.getScheme()     => http
      
      Show
      1. Set `proxy-address-forwarding="true"` on http-listener: 2. Deploy jsp that logs out request.getServerName/getServerPort/etc. 3. Make request with X-Forwarded-* headers present: # curl -H "X-Forwarded-Host:myhost" -H "X-Forwarded-Port: 80" http: //localhost:8080/sample_proxynameport/hello.jsp request.getServerName() => localhost request.getServerPort() => 8080 request.getScheme() => http
    • EAP 7.0.3

      If I configure `proxy-address-forwarding` for my http-listener, reqeust.getServerName and request.getServerPort still return the hostname/port from the Host header in the request. I would expect if `proxy-address-forwarding` is configured that the Apache proxy's hostname/port would be returned.

      I noticed that when I make a curl request with an empty Host header (like below) that the X-Forwarded-* headers are picked up by getServerName/getServerPort.

      Whereas, if I set Host header to empty it works:

      # curl -H "Host:" -H "X-Forwarded-Host:myhost" -H "X-Forwarded-Port: 80" http://localhost:8080/sample_proxynameport/hello.jsp
      request.getServerName() => myhost
      request.getServerPort() => 80
      request.getScheme()     => http
      

      However, not having a Host header is bad HTTP/1.1 and in future Undertow release the "workaround" above will not work (UNDERTOW-786).

              rhn-support-iweiss Ingo Weiss
              rhn-support-rbost Robert Bost
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: