-
Notifications
You must be signed in to change notification settings - Fork 470
ControllerLinkBuilder does not handle multiple X-Forwarded-* headers values #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@dsyer could you point to the RFC specifying the X-Forwarded-Port behaviour you implemented in spring-cloud/spring-cloud-netflix@a38b7b7 ? |
... found it, it's probably https://tools.ietf.org/html/rfc7239#section-4 -- but in this RFC only "by", "for", "host" and "proto" are defined. The spec allows extensions (#section-5.5), but basically, with regards to "port" it means, that it is implementation-specific. On the other hand, UriComponentsBuilder from spring-framework deals with comma-separated ports, since 4.2.0.RELEASE: |
There's no RFC for |
The ControllerLinkBuilder should just delegate this logic to UriComponentsBuilder, which as stated above, is already capable of correctly dealing with the X-Forwarded headers. |
Wouldn't mind to see a PR, @otrosien! |
…Framework. Removed the custom handling of proxy headers in ControllerLinkBuilder in favor of the behavior of UriComponentsBuilder in Spring Framework. The only thing that we keep custom is the handling of X-Forwarded-Ssl as it's rather non-standard. Original pull request: #519.
Formatting and author note. Original pull request: #519.
Thanks to @otrosien, that should be in place now. |
…ilder API. Our migration to the header handling for #509 (47cefe) unfortunately moved from starting with the servlet mapping for URI creation to using the full URI from the start. This is now fixed by switching back by creating a UriComponentsBuilder from the current servlet mapping. Related ticket: #509.
Hi,
Spring Cloud has released Camden.SR2 this week. It includes following bug fix from Spring Cloud Netflix project: spring-cloud/spring-cloud-netflix#959.
particular commit: spring-cloud/spring-cloud-netflix@a38b7b7
Based on that
X-Forwarded-Host
,X-Forwarded-Port
andX-Forwarded-Proto
could have multiple values separated by comma.X-Forwarded-Host
is already handled properly byControllerLinkBuilder
(spring-hateoas/src/main/java/org/springframework/hateoas/mvc/ControllerLinkBuilder.java
Lines 236 to 256 in 642b673
X-Forwarded-Port
andX-Forwarded-Proto
are not.Additionally for multiple values of
X-Forwarded-Port
header application is throwingNumberFormatException
because of input values like8080,443
etc.The text was updated successfully, but these errors were encountered: