Open nimatt opened 1 week ago
That looks like a body detection bug in Kestrel, filed https://github.com/dotnet/aspnetcore/issues/58753.
You should be able to workaround the issue by overriding the IHttpRequestBodyDetectionFeature
, e.g.
app.Use((context, next) =>
{
if (HttpProtocol.IsHttp3(context.Request.Protocol) && HttpMethods.IsGet(context.Request.Method))
{
// Workaround https://github.com/microsoft/reverse-proxy/issues/2644
context.Features.Set<IHttpRequestBodyDetectionFeature>(null);
}
return next();
});
Describe the bug
When performing a simple GET request over HTTP3 using Firefox, which gets forwarded using HTTP1.1. The outgoing request gets a
StreamCopyHttpContent
(with HTTP2 and HTTP1.1 it hasnull
as content) which leads toTransfer-Encoding
header being set tochunked
. This makes one of our servers behind the proxy throw errors.To Reproduce
Further technical details
Outgoing request GET / HTTP/1.1 Host: dev.local Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0 Accept-Encoding: gzip, deflate, br, zstd Accept-Language: en-US,en;q=0.5 Alt-Used: dev.local:8443 Cache-Control: no-cache Pragma: no-cache sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: none sec-fetch-user: ?1 priority: u=0, i X-Forwarded-For: 127.0.0.1 X-Forwarded-Host: dev.local X-Forwarded-Proto: https Transfer-Encoding: chunked