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 when multiple proxies, see PR#928 #1109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JonathanHuot
Copy link
Contributor

See initial bugreport in the PR #928

This should fix the case where bottle is behind multiple reverse-proxy, and each proxy is adding its own X-Forwarded-Host.
When the request arrives at the bottle level, we have multiple values in X-Forwarded-Host: www.foo.com, xyz.foo.local. It makes any uses of request.url/bottle functions not possible.

E.g.
With X-Forwarded-Host: www.foo.com, xyz.foo.local given:

Before the patch:
request.url == 'http://www.foo.com, xyz.foo.local/index.html'

After the patch:
request.url == 'http://www.foo.com/index.html'

@JonathanHuot
Copy link
Contributor Author

Any news on this ? Travis says the build is "pending" but it has been successfully completed.

@defnull
Copy link
Member

defnull commented Dec 1, 2019

I'm still convinced that a multi-valued X-Forwarded-Host header is a configuration error in the reverse-proxy or load-balancer setup, and does not make any sense. The header should contain the original Host as sent by the client, so only the first public-facing proxy should set this header and any additional back-end hops should completely ignore it.

Note that X-Forwarded-Host is different from X-Forwarded-For, wihc is multi-valued and already recognized as such by bottle.

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.

None yet

2 participants