Parse X-Forwarded-Port header even if X-Forwarded-Host is not present#2761
Merged
pderop merged 3 commits intoreactor:1.0.xfrom Apr 4, 2023
Merged
Parse X-Forwarded-Port header even if X-Forwarded-Host is not present#2761pderop merged 3 commits intoreactor:1.0.xfrom
X-Forwarded-Port header even if X-Forwarded-Host is not present#2761pderop merged 3 commits intoreactor:1.0.xfrom
Conversation
Member
|
@pderop What do you think about this? We need to recreate the host information only if we are able to parse the port. |
violetagg
approved these changes
Apr 4, 2023
| clientRequestHeaders.add("X-Forwarded-Proto", "https"); | ||
| }, | ||
| serverRequest -> { | ||
| Assertions.assertThat(serverRequest.remoteAddress().getHostString()).isEqualTo("192.168.0.1"); |
Member
There was a problem hiding this comment.
Let's check also the host address as we do in the rest of the tests
Suggested change
| 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); |
Contributor
Author
|
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
approved these changes
Apr 4, 2023
Contributor
Author
|
@violetagg , thanks for the review. |
X-Forwarded-Port header even if X-Forwarded-Host is not present
pderop
added a commit
that referenced
this pull request
Apr 4, 2023
This was referenced Apr 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Always takes into account any available
X-Forwarded-Portheader even if theX-Forwarded-Hostheader is missing.Fixes #2751