DKNet

Bound request size and duration

Part of DKNet.AspCore.Extensions. AddRequestBoundsConfig reads one RequestBoundsOptions object, configures Kestrel limits and removes its server header. It also registers a default request-timeout policy returning 504. UseRequestBoundsConfig installs timeout middleware only when marked.

using DKNet.AspCore.Extensions.Hosting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRequestBoundsConfig(builder.Configuration);
var app = builder.Build();
app.UseRequestBoundsConfig();
Console.WriteLine("RequestBoundsConfig pipeline configured.");

Bound request size and duration: the host registers settings and the matching Use method installs middleware only when its feature marker exists.

⚙️ Configuration reference

RequestBounds key Type Default Effect
RequestTimeoutSeconds int 30 Default timeout duration, with 504 timeout status.
MaxRequestBodySizeBytes long 1048576 Kestrel maximum body size.
RequestHeadersTimeoutSeconds int 10 Kestrel header-read timeout.

⚠️ Gotchas & limits