All Products
Search
Document Center

:Failed to upload large files through HTTP and HTTPS protocols after adding DDoS high protection

Last Updated:May 17, 2021

Problem description

After you add Anti-DDoS Premium to your business, you fail to upload a large file over HTTP and HTTPS. The following error is displayed.

413 Request Entity Too Large
The requested resource does not allow request data with the requested method or the amount of data provided in the request exceeds the capacity limit.

Cause

The reason for this problem is as follows:

  • When the uploaded file is larger than 2GB, it is caused by the restrictions of Anti-DDoS Pro. Anti-DDoS Premium is based on Tengine architecture and is also a reverse proxy service. There is a limit on the size of uploaded files (up to 2GB).

  • When the uploaded file is smaller than 2GB, the DDoS Pro backend service limits the size of the uploaded file.

Solution

You first confirm the size of the uploaded file, and select the corresponding solution according to the size of the file:

The uploaded file is larger than 2GB

The solution to the maximum upload limit of 2GB files is as follows:

  • You can add the packaging and compression function to your business, compress your files to less than 2GB, and then upload the compressed files.
  • If the file cannot be packaged and compressed, we recommend that you upload the file to OSS. For more information, see Upload the file through OSS.
    Note: The maximum value of the uploaded object varies from OSS interface to OSS interface. The maximum value of a single uploaded file for the putObject and postObject interfaces is 5GB, while the maximum value of the uploaded file for the sharding interface is very large. Basically, there is no need to consider its limitation.
  • You can skip Anti-DDoS Pro and upload files through addresses that are not protected by Anti-DDoS Pro.

The uploaded file is smaller than 2GB

This section uses Nginx as an example to describe how to adjust the maximum value of uploaded files when the DDoS Pro backend service limits the size of uploaded files:

  1. Edit the nginx.conf configuration file of Nginx, add or modify the following parameters.
    client_max_body_size [$Num]
    Note: Set [$Num] to a value greater than the size of the uploaded object. This value is the value of the maximum uploaded object.
  2. Run the following command to confirm that the Nginx configuration file is normal:
    nginx -t
  3. Run the following command to reload Nginx.
    nginx -s reload

References

The value of the maximum uploaded file for related products is as follows:

  • Anti-DDoS Premium: 2GB
  • WAF:2GB
  • SLB: 50 GB

Application scope

  • Anti-DDoS