-
Notifications
You must be signed in to change notification settings - Fork 646
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
Parse X-Forwarded-Port
header even if X-Forwarded-Host
is not present
#2761
Conversation
@pderop What do you think about this? We need to recreate the host information only if we are able to parse the port.
|
clientRequestHeaders.add("X-Forwarded-Proto", "https"); | ||
}, | ||
serverRequest -> { | ||
Assertions.assertThat(serverRequest.remoteAddress().getHostString()).isEqualTo("192.168.0.1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check also the host address as we do in the rest of the tests
Assertions.assertThat(serverRequest.remoteAddress().getHostString()).isEqualTo("192.168.0.1"); | |
Assertions.assertThat(serverRequest.remoteAddress().getHostString()).isEqualTo("192.168.0.1"); | |
Assertions.assertThat(serverRequest.hostAddress().getHostString()) | |
.containsPattern("^0:0:0:0:0:0:0:1(%\\w*)?|127.0.0.1$"); | |
Assertions.assertThat(serverRequest.hostAddress().getPort()).isEqualTo(8443); |
I have Applied the two feedbacks. Can you recheck please ? Indeed, recreating the host information only if we are able to parse X-Forwarded-Port has the following benefit: if |
@violetagg , thanks for the review. |
X-Forwarded-Port
header even if X-Forwarded-Host
is not present
Always takes into account any available
X-Forwarded-Port
header even if theX-Forwarded-Host
header is missing.Fixes #2751