Support forwarded headers that do not contain a host key #788
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.
Related Issue(s):
Description:
The proxy header middleware doesn't parse the value of the
proto
key in case there is nohost
key as well. Which is the case ifstac-fastapi
is running on GCP as cloud run service behind their load balancer. Additionally it even failed withUnboundLocalError
sinceport_str
was never defined in that execution path but still used later on.That's a small oversight from the last PR (#782) - I noticed it now after upgrading to v4.0.
I also added a testcase for an exact
forwarded
header that I receive on gcp - so that hopefully this finally fixes the issue.PR Checklist:
pre-commit
hooks pass locallymake test
)make docs
)