Yang
Yang

Reputation: 503

ASP.NET Core 2.1 Invalid Request Line Issue

Our Linux Docker ASP.NET Core container server logs are getting filled by the following 'Informational' log entries since we've updated from .NET Core 2.0 to .NET Core 2.1 (SDK 2.1.302):

INFO|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HLFG42JUAORG" bad request 
data: "Invalid request line: 
'CNXN\x00\x00\x00\x01\x00\x00\x04\x00\x1B\x00\x00\x00M\x0A'" 
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid 
request line: 'CNXN\x00\x00\x00\x01\x00\x00\x04\x00\x1B\x00\x00\x00M\x0A'

INFO|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HLFG42JUAORH" bad request 
data: "Invalid request line: 
'CNXN\x00\x00\x00\x01\x00\x00\x04\x00\x1B\x00\x00\x00M\x0A'" 
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid 
request line: 'CNXN\x00\x00\x00\x01\x00\x00\x04\x00\x1B\x00\x00\x00M\x0A'

The connection ID is incrementing by 1 alpha/digit every second or so. The hex doesn't seem translate to anything meaningful (NUL NUL NUL SOH NUL NUL EOT NUL ESC NUL NUL LF).

Things we've ruled out:

Upvotes: 20

Views: 15544

Answers (3)

Radosław Adamczewski
Radosław Adamczewski

Reputation: 11

I had same problem and in my case solution was in nginx configuration - I had proxy_pass set to https://localhost:4000 instead of http://localhost:4000

Upvotes: 1

Gurgen Sargsyan
Gurgen Sargsyan

Reputation: 1087

It looks like you're hitting an HTTP endpoint over HTTPS.

Upvotes: 32

Yang
Yang

Reputation: 503

Turns out it was an issue with the docker host (debian) and hanging sockets (netstat showing a lot of TIME_WAITs). Changed the app port to a different one and the malformed requests stopped.

A reboot or restart of the docker daemon would probably also fix it, but the uptime of our other containers is vital so we weren't able to test that.

Upvotes: 5

Related Questions