core icon indicating copy to clipboard operation
core copied to clipboard

aiohttp.server message="Bad status line 'Invalid method encountered'"

Open KitHubek opened this issue 2 years ago • 20 comments

The problem

After upgrade to newest 2022.6.7 i see this error at logs

What version of Home Assistant Core has the issue?

2022.6.7

What was the last working version of Home Assistant Core?

i dont remember

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:405
First occurred: 03:36:42 (3 occurrences)
Last logged: 08:20:30

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

Additional information

No response

KitHubek avatar Jun 23 '22 07:06 KitHubek

I have the same issue after upgrading my containerized HA from 2022.5.2 to 2022.6.7

Error I'm seeing:

File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

This happens upon startup since the upgrade. Using old container fortunately worked okay

lubosjerabek avatar Jun 28 '22 20:06 lubosjerabek

Not an issue in my case.

After searching on the internet I came to conclusion that one of my devices in LAN is trying to connect to :8123 port using HTTPS.

I've reviewed all phones and tablets and turned out it was my sons device.

This was coincidence that it happened after upgrade.

tomhash2 avatar Jul 06 '22 16:07 tomhash2

Having the same error and occors 18 times, but not every day:

Logger: aiohttp.server Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 First occurred: 2 augustus 2022 om 16:48:11 (18 occurrences) Last logged: 05:36:10

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

Running on RPI4 - core-2022.7.3 - Home Assistant OS 8.4

Dutchstyler avatar Aug 05 '22 09:08 Dutchstyler

I see the same error accompanied by another one before it.

2022-08-13 06:41:11.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

2022-08-13 06:45:03.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

I have changed IP address of my HA instance to test the possibility of the reason tomhash2 gave that some device is trying to connect to HA instance using HTTPS and port 8123. Since I still this these errors, the HTTPS and port 8123 is not the reason in my case.

vaibhav2912 avatar Aug 13 '22 15:08 vaibhav2912

I see the same error accompanied by another one before it.

2022-08-13 06:41:11.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

2022-08-13 06:45:03.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

I have changed IP address of my HA instance to test the possibility of the reason tomhash2 gave that some device is trying to connect to HA instance using HTTPS and port 8123. Since I still this these errors, the HTTPS and port 8123 is not the reason in my case.

UPDATE: I did grep for my IP address in the config directory and found one auth token that was using https on my old IP address:8123.

grep result: .storage/auth:462: "client_id": "https://192.168.1.108:8123/"

I opened config/.storage/auth file, went to this auth entry, found the device ID and searched for that again in the config directory. It was from my Galaxy watch. I have removed the auth token now.

Might be helpful for people to search for devices using HTTPS for port 8123 to reach HA instance.

BUT, in my case, I didn't change the IP address on my watch after I changed my HA IP. So, the watch couldn't have pinged my new IP with HTTPS and port 8123. So the aiohttp errors I got today morning (posted in the quoted message) are definitely not from my watch pinging 8123 using HTTPS.

I will report back if I see the errors again.

vaibhav2912 avatar Aug 13 '22 16:08 vaibhav2912

I see the same error accompanied by another one before it.

2022-08-13 06:41:11.153 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

2022-08-13 06:45:03.774 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

I have changed IP address of my HA instance to test the possibility of the reason tomhash2 gave that some device is trying to connect to HA instance using HTTPS and port 8123. Since I still this these errors, the HTTPS and port 8123 is not the reason in my case.

UPDATE: I did grep for my IP address in the config directory and found one auth token that was using https on my old IP address:8123.

grep result: .storage/auth:462: "client_id": "https://192.168.1.108:8123/"

I opened config/.storage/auth file, went to this auth entry, found the device ID and searched for that again in the config directory. It was from my Galaxy watch. I have removed the auth token now.

Might be helpful for people to search for devices using HTTPS for port 8123 to reach HA instance.

BUT, in my case, I didn't change the IP address on my watch after I changed my HA IP. So, the watch couldn't have pinged my new IP with HTTPS and port 8123. So the aiohttp errors I got today morning (posted in the quoted message) are definitely not from my watch pinging 8123 using HTTPS.

I will report back if I see the errors again.

Saw the same error messages again. So what I did above didn't solve it.

2022-08-13 23:33:53.827 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
2022-08-13 23:33:55.044 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

vaibhav2912 avatar Aug 14 '22 04:08 vaibhav2912

Any progress on this issue? I´ve got the error more than once (see above).

Logger: aiohttp.server
Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 
First occurred: 2:13:21 PM (959 occurrences) 
Last logged: 2:14:59 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

Is there I could do to present more details?

controlcde avatar Nov 05 '22 13:11 controlcde

I'm facing same issue. Please help

Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.202 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.699 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.732 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.766 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.795 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'" Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: 2022-11-15 13:59:07.826 ERROR (MainThread) [aiohttp.server] Error handling request Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: Traceback (most recent call last): Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: messages, upgraded, tail = self._request_parser.feed_data(data) Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data Nov 15 13:59:07 NUC11PAHi7 homeassistant[6196]: aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

rajalingamj175 avatar Nov 15 '22 19:11 rajalingamj175

Same issue here, any updates on this?

I have a feeling it relates back to Nginx, which I'm using to reverse-proxy to my HA instance. I don't have any issues (I don't think) from the app on iOS, but when using Firefox on my laptop it can take ages to load HA through the reverse proxy and I see the same errors others are reporting...

m-reiner avatar Nov 22 '22 00:11 m-reiner

Hi.

I have similar error in my case after update HA 2022.12. My environment: HA Core (docker version).

This is the log:

2022-12-16 13:08:27.734 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

In log have 9 occurrences

Thanks

baldus88 avatar Dec 16 '22 13:12 baldus88

Same issue here for me!

Logger: aiohttp.server
Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405
First occurred: 11:43:34 AM (5 occurrences)
Last logged: 11:44:11 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

GarnetSunset avatar Jan 02 '23 16:01 GarnetSunset

Same issue:

HA 2023.01.1

Logger: aiohttp.server Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 First occurred: 16:42:05 (1 occurrences) Last logged: 16:42:05 Error handling request

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

fuzzybear62 avatar Jan 06 '23 17:01 fuzzybear62

Same here: 2023-01-23 00:14:23.930 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

pkleingu avatar Jan 22 '23 23:01 pkleingu

Similar here, message is different: Logger: aiohttp.server Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405 First occurred: 3:22:08 PM (1 occurrences) Last logged: 3:22:08 PM Error handling request

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadHttpMessage: 400, message='Pause on PRI/Upgrade'

jum0n avatar Jan 28 '23 21:01 jum0n

Same here:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 332, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

MakStashkevich avatar Feb 06 '23 11:02 MakStashkevich

#87861

jocamane avatar Feb 11 '23 18:02 jocamane

Logger: aiohttp.server
Source: /usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py:405
First occurred: 12:21:51 (12175 occurrences)
Last logged: 19:25:40

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"

cayco avatar Feb 13 '23 18:02 cayco

Getting the same issues, and have isolated it down to my iOS home companion app remote accessing the HA instance, via external URL. Accessing the HA instance via internal URL has no issues.

In my case, I am accessing it remotely via http (unsecured) via duckdns, and with my router port forwarding 8123 to the HA device.

borez avatar Feb 25 '23 07:02 borez

In my case, I am accessing it remotely via https (secured) via duckdns, and with my router port forwarding 8123 to the HA device

jocamane avatar Feb 25 '23 15:02 jocamane

To add on, I get the same error as long I’m using external URL functionality. Used an internal IP on the external URL section, via wifi.

borez avatar Feb 26 '23 23:02 borez

Double-check the URL you're using in your request. Make sure it's correctly formatted and that there are no extra characters or spaces. Ensure the URL scheme (http/https) is correct for the API you're using. I had a similar problem, I specified the port to a URL, but it was not necessary.

nodermann2 avatar Apr 05 '23 09:04 nodermann2

I found out that such errors occur when the https://about.censys.io/ service sends requests like: 167.94.138.126 [28/Apr/2023:01:49:57 +0000] "GET / HTTP/1.1" 404 172 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys. io/)" On their official website, you can see from which ip addresses this happens and block them on the server->> https://support.censys.io/hc/en-us/articles/360043177092-Opt-Out-of-Data-Collection

Vladimirlashuk avatar Apr 28 '23 03:04 Vladimirlashuk

I found out that such errors occur when the https://about.censys.io/ service sends requests like: 167.94.138.126 [28/Apr/2023:01:49:57 +0000] "GET / HTTP/1.1" 404 172 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys. io/)" On their official website, you can see from which ip addresses this happens and block them on the server->> https://support.censys.io/hc/en-us/articles/360043177092-Opt-Out-of-Data-Collection

But I don't have censys service !!!

jocamane avatar Apr 28 '23 19:04 jocamane

Same here, using NGINX Home Assistant SSL proxy 3.5.0 2023.6.1 Home Assistant OS 10.2

mitag avatar Jun 10 '23 12:06 mitag

Same Problem here

benwainwright avatar Jun 13 '23 15:06 benwainwright

I did a fresh install of HAOS 10.3 with 2023.6 and then immediately installed the Let's Encrypt add-on and issued a wildcard SSL cert. When I restart HA and attempt to access HA via HTTPS it fails, and I see the error in this thread in the log.

Coder84619 avatar Jun 25 '23 00:06 Coder84619

guys, have a same problem my HA works in docker by typing docker logs homeassistant i see:

2023-06-30 00:41:32.471 ERROR (MainThread) [homeassistant.components.http.forwarded] Received X-Forwarded-For header from an untrusted proxy 172.28.0.1

the ip 172.28.0.1 is my docker network. I just added this net to trusted proxy and it all work fine now. I also usng https with duckdns. Hope my solution will help you

My nginx.conf with reverse proxy on it

server { server_name homeassistant.bla.bla; proxy_ssl_server_name on; location / { proxy_ssl_name $host; proxy_pass http://localhost:8123; #HA is on 80 port, docker listen 8123 proxy_set_header Host $host; proxy_pass_header Authorization;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
} listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/homeassistant.bla.bla/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/homeassistant.bla.bla/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot }

server { if ($host = homeassistant.bla.bla) { return 301 http://$host:8123$request_uri; } # managed by Certbot server_name homeassistant.bla.bla; listen 80; return 404; # managed by Certbot }

hkphh avatar Jun 29 '23 19:06 hkphh

This may be related to this issue: https://github.com/aio-libs/aiohttp/issues/7208

Basically, if the request does not set content-length, aiohttp server returns 400 with Invalid method encountered.

rynewang avatar Jul 03 '23 04:07 rynewang

It happens to me right now when calling Google Translate TTS.

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message: Bad status line "Invalid method encountered:\n\n b'\\x16\\x03\\x01\\x02'\n ^"

tricksel avatar Sep 30 '23 23:09 tricksel

Same issue on my side: 2023-10-08 17:02:25.552 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message: Bad status line "Invalid method encountered:\n\n b'\\x16\\x03\\x01\\x02'\n ^"

Marco4223 avatar Oct 08 '23 15:10 Marco4223