Consider port number when setting the host from the X-Forward-Host header#90
Consider port number when setting the host from the X-Forward-Host header#90frankbille wants to merge 2 commits into
Conversation
…header. If we don't and we also use a port in the proxyTo address, we will end up with a host:port:port address causing an exception.
|
can somebody explain why spring-hateoas cares for the x-forwarded header at all? shouldn't this be handled by the servlet container? |
|
Not really, this seems like a hack, but it caused a problem for me. If it can be simplified and have the servlet container handle it it would be better for me. I just don't have the overview of it is possible. |
|
i can give you an example for jetty. if you set as a framework i would expect the current servlet request to contain the uri/port as it is seen by the client. EDIT: of cause both configs only have an effect when the header is set |
ControllerLinkBuilder now correctly uses the X-Fowarded-Host header by inspecting it for a port being set and configuring the discovered one on the ServletUriComponentsBuilder created. Also added that the first host listed in the header is used.
|
No problem. I agree with Laures, that it is annoying that we have to consider the proxy in front of the server, but f.ex. on Google App Engine, it doesn't handle it for us. So either the core Spring framework or it's modules has to. I signed the CLA, and got this confirmation number: 58420130704035452 |
If we don't and we also use a port in the proxyTo address, we will end up with a host:port:port address causing an exception.