Today, a dynamic domain name configuration was added to file upload, but after configuration, the upload suddenly failed, and only the H5 on the mobile side reported error 413---The request body is too large. There are no problems with the App and H5 on PC and they run normally.
Because my project is deployed on nginx, when I was on Baidu, I suddenly saw a sentence that the default request body size of nginx is 1M.
//nginx 默认是 1MB
client_max_body_size
So, I checked the size of the picture, and it was 678KB. Hahaha, besides the picture, there was other data. This was probably too much, so I expanded it to 20MB with a wave of my hand.
client_max_body_size 20M;
This configuration can be placed on http, server or location, depending on your needs.
After configuring, reload nginx, test data, and the bug is gone.