'Can't upload a file to nginx server with fetch

I have an application written with Laravel where I upload and serve some files. It worked fine until I tried to upload a file that is 124MB in size. Fetch request raises:

ERR_QUIC_PROTOCOL_ERROR.QUIC_IETF_GQUIC_ERROR_MISSING

And when I disable Experimental QUIC protocol on chrome://flags than the fetch request fails with

TypeError: Failed to fetch

There is nothing on the error.log and according to the access.log the POST request doesn't make it to the server.

The server is nginx version: nginx/1.18.0 (Ubuntu)

The relevant php settings are below. The same settings are configured for my local Xampp configuration and upload works fine on local.

max_execution_time=300
upload_max_filesize = 0
post_max_size = 0


Solution 1:[1]

NGINX has a max POST size limit. Change it to client_max_body_size 256M; or what ever you need in a server or location config:

location /uploads {
   ...
   client_max_body_size 256M;
}

Don't forget to restart the service after the modification.

Solution 2:[2]

Finally after trying for hours fetch request returned a response with the cause of the error. The culprit turned out to be Cloudflare. Cloudflare allows up to 100MB of uploads in the free plan. I disabled proxy for the subdomain, installed certbot for ssl and everything is working now.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Patrick Janser
Solution 2 krypt