reactjsasp.net-corenginxreact-typescriptuppy

.Net core and React uppy.io 110mb file upload exception "Unexpected end of request content."


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


Solution

  • 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; 
                });