johnkors / bodylogging

Repro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup

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();

Request

Sending a body:

Logs without Request body:

Workaround

Adding a middleware that reads the body:

Logs then shows the body:

About

Repro


Languages

Language:C# 100.0%