-
Hey I was looking for a way to intercept the request and manually inject Content-Length header with 0 but could not find the way to do it. The server is running without a reverse-proxy in front of it and the requests go directly to Kestrel docker pod. I searched the Kestrel source code and found a check for that specifically: but I could not find any way to override this behavour. Is there any way to configure or intercept this behaviour and manually add a Content-Length header with 0 value or somehow make it pass this validation? There is another way to solve this issue by putting a reverse-proxy in front of Kestrel that will fix the headers, but I don't want to introduce a new component in the chain if it is other way. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
No there's no way to inject logic at this stage, it's too early. Only a reverse proxy can help you here. |
Beta Was this translation helpful? Give feedback.
-
https://tools.ietf.org/html/rfc7230#section-3.3.3
https://tools.ietf.org/html/rfc7231#section-4.3.3 (POST) doesn't say anything about 411s or requiring a non-zero body. I think Kestrel is wrong here, it should default to no-body when there is no content-length or chunked for HTTP/1.x. I'll open an issue. (#29398) This is a non-issue for HTTP/2 since the introduction of the END_OF_STREAM flag. |
Beta Was this translation helpful? Give feedback.
No there's no way to inject logic at this stage, it's too early. Only a reverse proxy can help you here.
cc @halter73 @Tratcher