TrustedHostMiddleware Doesn't handle IPv6 properly #3321
Unanswered
gopackgo90
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Say I have the below Starlette app,
and run it with
uvicorn main:app --host '::1'. When I go to http://[::1]:8000 in my browser, I get the "Invalid host header" response. This appears to be because Starlette is thinking the host is"["based on the splitting logic in the middleware,starlette/starlette/middleware/trustedhost.py
Line 40 in 70a3bd4
When I remove the
TrustedHostMiddleware, I get the hello world response as expected.Beta Was this translation helpful? Give feedback.
All reactions