Throw if a request transform overrides the request HttpContent #2722
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From #2721
If you look at https://github.com/microsoft/reverse-proxy/blob/main/src/ReverseProxy/Forwarder/HttpForwarder.cs you can search for
requestContent
.A few examples:
ForwarderError
, proxy's response status code)ContentTransferring
telemetry will not be emittedHttpContent
to reliably synchronize the request with how the body is read. As a result, you could see thread-safety issues as your custom content logic may still be running (and using things like the HttpContext) when YARP already exits.It's possible some scenarios happened to work well enough that someone is using this. We could consider logging an error instead of throwing, but it's something that users should not do either way.