nginx .net 6 webapi 500 bad request when request header content-length more than 10k or upload file more than 7k

志彬 李 0 Reputation points
2023-04-11T13:41:41.7233333+00:00

environment:Linux、Nginx、.Net 6 WebApi application i get a 500 bad request when i post data to the webapi with a content-length more than about 10k how to fix this problem? i can't get the exception through try catch or IAsyncExceptionFilter filter,because the webapi return 500 bad request directly

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,249 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 58,126 Reputation points
    2023-04-11T15:10:55.5966667+00:00

    In the ngnix.config file increase the max request size

    http{
       ...
       client_max_body_size 50M;
       ...
    }
    
    
    0 comments No comments