The problem

I used Nginx to do the interface forwarding, other interfaces are normal, but the file uploading has been reported cross-domain problems.

misarrangement

Ubuntu operating system:

First check the error log for Nginx: tail -f /var/log/nginx/error.log

Found the following error:

client intended to send too large body: 2211873 bytes

It turns out that the file is too large to forward, but it was blocked by NGINX.

The solution

Modify the nginx configuration:

sudo vim /etc/nginx/nginx.conf

Add client_max_body_size 1024M in HTTP parentheses; (Here the upper limit size of the file is modified according to your own needs) as follows:

http { ... client_max_body_size 1024M; . }

Then restart nginx:

sudo service nginx restart

The last

When cross-domain problems occur:

  1. So let’s check if I have the path right
  2. Write all the right to read the log! Be sure to develop the good habit of reading your journal. Don’t make mistakes.