0

I have a Asp.net core 3.1 api and react typescript application.

When large file uploaded then i get exception this error

"Unexpected end of request content."

enter image description here

React component is Uppy.io and upload method is XHR

I use nginx for request receive

I tried below solutions

  1. nginx large file settings client_max_body_size 2000M;
  2. Asp.net Core file settings options.Limits.MaxRequestBodySize = long.MaxValue;

But not work

I tried 20mb file to slowing down the browser for determine the problem. It is work. In my opinion problem is not long upload time.

I tested on 110 mb file

Uppy.io component is progress 100 then waiting 30 second and throw exception

ismail ERDEN
  • 138
  • 1
  • 9
  • Is the app running in an environment with limited RAM? You might be getting an OOM error somewhere – abdusco Jul 13 '21 at 08:08
  • @abdusco I checked server. It is vm and 7gb ram available. Application created with kestrel service not docker. – ismail ERDEN Jul 13 '21 at 08:48
  • Are there any reverse proxies in front of nginx? A firewall perhaps? They might be dropping the connection once the request size exceeds a certain size. Check the browser console. Does anything strange happen when the upload stops? – abdusco Jul 13 '21 at 09:10

1 Answers1

0

I solved to my problem.

I Added on below code on nginx location block.

It's Work

proxy_http_version 1.1;
proxy_set_header Connection keep-alive;
client_max_body_size 2000M;
proxy_request_buffering off;
proxy_send_timeout 1h;
proxy_read_timeout 1h;

Asp.net added to below code

services.Configure<FormOptions>(x =>
            {
                x.ValueLengthLimit = int.MaxValue;
                x.MultipartBodyLengthLimit = int.MaxValue; 
            });
ismail ERDEN
  • 138
  • 1
  • 9