HTTP 431 when header size over 32KB #304

Closed
opened 2025-12-29 15:20:18 +01:00 by adam · 4 comments
Owner

Originally created by @eduherminio on GitHub (Oct 14, 2020).

I'm getting HTTP 431 status codes when making requests to a sheyenrath/wiremock.net image with headers over 32KB.

I assumed that the issue was KestrelServerLimits.MaxRequestHeadersTotalSize, but I'm failing to prove it.

I've created a local wiremock.net image with StandAlone.NETCoreApp using a local WireMock.Net package where I'm setting options.Limits.MaxRequestHeadersTotalSize = 150_000; in both .NET Standard1.3 and .NET Standard > 1.3, but I'm still getting those 431s.

Am I missing something? Any other idea of what could be causing those 431s?

Originally created by @eduherminio on GitHub (Oct 14, 2020). I'm getting HTTP 431 status codes when making requests to a `sheyenrath/wiremock.net` image with headers over 32KB. I assumed that the issue was [KestrelServerLimits.MaxRequestHeadersTotalSize](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.server.kestrel.core.kestrelserverlimits.maxrequestheaderstotalsize?view=aspnetcore-3.1#Microsoft_AspNetCore_Server_Kestrel_Core_KestrelServerLimits_MaxRequestHeadersTotalSize), but I'm failing to prove it. I've created a local `wiremock.net` image with `StandAlone.NETCoreApp` using a local `WireMock.Net` package where I'm setting `options.Limits.MaxRequestHeadersTotalSize = 150_000;` in both [.NET Standard1.3](https://github.com/WireMock-Net/WireMock.Net/blob/432fb54abae42b0257a3ee5b5c46e8ac6f62e481/src/WireMock.Net/Owin/AspNetCoreSelfHost.NETStandard13.cs#L18) and [.NET Standard > 1.3](https://github.com/WireMock-Net/WireMock.Net/blob/432fb54abae42b0257a3ee5b5c46e8ac6f62e481/src/WireMock.Net/Owin/AspNetCoreSelfHost.NETStandard.cs#L17), but I'm still getting those 431s. Am I missing something? Any other idea of what could be causing those 431s?
adam added the question label 2025-12-29 15:20:18 +01:00
adam closed this issue 2025-12-29 15:20:18 +01:00
Author
Owner

@StefH commented on GitHub (Oct 14, 2020):

Hello @eduherminio, does the same issue occur when you just run the StandAlone.NETCoreApp locally, so without docker?

@StefH commented on GitHub (Oct 14, 2020): Hello @eduherminio, does the same issue occur when you just run the StandAlone.NETCoreApp locally, so without docker?
Author
Owner

@eduherminio commented on GitHub (Oct 14, 2020):

Yes it does @StefH.

@eduherminio commented on GitHub (Oct 14, 2020): Yes it does @StefH.
Author
Owner

@StefH commented on GitHub (Oct 14, 2020):

And you use a .NET Core 3.1 ?

@StefH commented on GitHub (Oct 14, 2020): And you use a .NET Core 3.1 ?
Author
Owner

@eduherminio commented on GitHub (Oct 14, 2020):

My bad, I messed up the package versions. Modifying MaxRequestHeadersTotalSize does seem to fix the issue. Thanks!
I'll follow up with a separated issue/feature request to discuss the possibility of having it modified or allowing its modification, if that's OK with you.

@eduherminio commented on GitHub (Oct 14, 2020): My bad, I messed up the package versions. Modifying `MaxRequestHeadersTotalSize` does seem to fix the issue. Thanks! I'll follow up with a separated issue/feature request to discuss the possibility of having it modified or allowing its modification, if that's OK with you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#304