Skip to content

Requesting Guidance: Auditing request/response data possibly found in req/res body content #1147

Answered by Tratcher
curiousdev asked this question in Q&A
Discussion options

You must be logged in to vote

YARP does not directly support inspecting the request or response body and discourages doing so for performance reasons, but yes it can be done with middleware.

The primary concern is to make sure that its done in a pass through fashion to avoid adding latency to the original request/response, breaking streaming protocols, and using excess memory.

An example that does pass through request/response interception is the new logging middleware. It wraps the request and response body APIs and then observes the data as it's passed through.
https://github.com/dotnet/aspnetcore/blob/1d7ee979fec5a09ac82cfae0db1f039e63fea4dc/src/Middleware/HttpLogging/src/HttpLoggingMiddleware.cs#L118-L129
https://…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@curiousdev
Comment options

Answer selected by karelz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1146 on July 07, 2021 17:44.