-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
HTTPS requests received on HTTP port show generic BadStatusLine exception #8065
Comments
This is becoming more frequent due to Chromium’s automatic HTTPS upgrades, where HTTPS requests are attempted on the same port if a port number is specified in the URL. Related: |
Seems reasonable if someone want to volunteer to make the change. It will need a change for both Python and Cython parsers. |
This error comes up quite often when there isn't anything actually wrong, and its quite expected that anything exposed to the public internet will get quite a bit of garbage traffic that will generate these errors. We should probably downgrade it to debug logging. |
Looks like this comes up fairly frequently downstream as well |
I think it makes sense to make it a debug log at this point, though the noisiness in the past has been pretty helpful as most exceptions reported turned out to be parser bugs. I'm a lot more confident in the parser these days, so don't mind reducing the output. But, even logging, we should improve the error message in this specific case by checking the first 2 bytes are |
Describe the bug
When an HTTPS request is sent to the HTTP server port, a generic exception is thrown
aiohttp.http_exceptions.BadStatusLine: 400, message: Invalid method encountered
.This has caused confusion for some Home Assistant users with a misconfigured reverse-proxy set-up. With this message, it is not always clear where the issue is. Example.
To Reproduce
Send a HTTPS request on the HTTP port.
Expected behavior
b'\x16\x03' appears to be a known HTTPS connection message. Given that we know this, a more descriptive error message (in lieu of
Invalid method encountered
) could be provided, such asReceived HTTPS traffic on HTTP port
.Logs/tracebacks
Python Version
3.11.6
aiohttp Version
3.9.1
multidict Version
6.0.4
yarl Version
1.9.4
OS
Home Assistant OS 11.4
Related component
Server
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: