Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1282

HttpServletRequest.getLocalPort() returned value does not reflect value specified by Forwarded~by header

XMLWordPrintable

      HttpServletRequest.getLocalPort() method does not reflect case when Forwarded ~ by header is defined in request.

      Header value in request:

      Forwarded=for=192.121.210.60:455;proto=https;by=203.0.113.43:777

      What particular methods return in case of handler usage:

      HttpServerExchange.getSourceAddress() = /192.121.210.60:455
      HttpServerExchange.getRequestScheme() = https
      HttpServerExchange.getDestinationAddress() = /203.0.113.43:777

      Those are correct.

      Servlet case:

      HttpServletRequest.getRemoteAddr() = 192.121.210.60
      HttpServletRequest.getRemoteHost() = 192.121.210.60
      HttpServletRequest.getRemotePort() = 455
      HttpServletRequest.getScheme() = https
      HttpServletRequest.getLocalName() = 203.0.113.43
      HttpServletRequest.getLocalAddr() = 127.0.0.1 <--- this is fixed by UNDERTOW-1280
      HttpServletRequest.getLocalPort() = 8080

      Returned value of getLocalPort() does not reflect Forwarded ~ by header value. Correct value in this case should be 777.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              jstourac@redhat.com Jan Stourac
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: