Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15504

UriComponentsBuilder's fromHttpRequest uses server port as host port when handling the Forwarded header

    Details

      Description

      The UriComponentsBuilder's adaptFromForwardedHeaders method doesn't handle the host port of the Forwarded header correctly, which means that the URI generated through the fromHttpRequest method will append the server port to the host (of the Forwarded header), instead of just using the port (if any) defined in the host part of the Forwarded header.
      According to the RFC https://tools.ietf.org/html/rfc7239#section-5.3 and https://tools.ietf.org/html/rfc7230#section-5.4 the host part of the Forwarded header "provides the host and port information from the target URI", and as such should be handled in the adaptFromForwardedHeaders method.

      The pull request 1413 will try to parse the port of the host of the Forwarded header, and configure the builder accordingly.

      related pull request: https://github.com/spring-projects/spring-framework/pull/1413

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rstoya05-aop Rossen Stoyanchev
                Reporter:
                gvdenbro Gregory Vandenbroucke
                Last updater:
                S├ębastien Deleuze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 11 weeks, 2 days ago