using Microsoft.AspNetCore.HttpLogging;
using Yarp.ReverseProxy.Configuration;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpLogging(c =>
{
c.LoggingFields = HttpLoggingFields.RequestBody;
c.RequestBodyLogLimit = 100000000;
});
builder.Services
.AddReverseProxy()
.LoadFromMemory(…) // snipped. See Program.cs
});
var app = builder.Build();
app.UseHttpLogging();
app.MapReverseProxy();
app.MapPost("/", () => "Hello Post!");
app.Run();
Sending a body:
Logs without Request body:
Adding a middleware that reads the body:
Logs then shows the body: