Skip to content
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

fix: X-Forwarded-Host header can be array or comma separated list #499

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

benoitf
Copy link
Member

@benoitf benoitf commented Jul 27, 2022

Headers can be array values or be a single string with comma separated value

So when computing the host using X-Forwarded-Host it should use the first value and not the 'joined' list concatenate by a comma else it leads to invalid base URL

example:

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers

Be careful when using these headers on the origin server, since they will contain more than one (comma-separated) value if the original request already contained one of these headers. For example, you can use %{X-Forwarded-For}i in the log format string of the origin server to log the original clients IP address, but you may get more than one address if the request passes through several proxies.

Fixes #498

Change-Id: I4407776a5296809e304e3c8b10dafe50e9929035
Signed-off-by: Florent Benoit fbenoit@redhat.com

@benoitf benoitf marked this pull request as draft July 28, 2022 09:56
handle the usecase
Fixes eclipse#498

Change-Id: I4407776a5296809e304e3c8b10dafe50e9929035
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
@benoitf benoitf marked this pull request as ready for review July 28, 2022 10:02
@benoitf benoitf changed the title fix: X-Forwarded-Host header can be array fix: X-Forwarded-Host header can be array or comma separated list Jul 28, 2022
@benoitf
Copy link
Member Author

benoitf commented Aug 3, 2022

@amvanbaren if you can review my PR
Unit tests are provided

@benoitf
Copy link
Member Author

benoitf commented Sep 12, 2022

Hi, what is preventing this PR to be merged ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X-Forwarded-Host header is not working when an array or comma separated list is used
2 participants