Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
I get "413 Entity too large" then "502 Bad Gateway" after I increased
I met a trouble with the size of my request. I have tried to send 14 pictures in my request so the bodysize was superior to 1.5 Mb, I got “413 Entity too large”.
So I followed instructions I found here and increased the clientmaxbodysize to 10 Mb in nginx.conf
Now the problem is not fixed, I dont meet 413 anymore but now I meet “502 Bad Gateway” and a part of my request is readed (10 / 14 pictures are correctly uploaded and I made a lot of test, the problem doesn’t come from the image)
When I run “sudo tail -F /var/log/nginx/error.log” I can see
“upstream prematurely closed connection while reading response header from upstream”
It is really strange because when I run the application in virtual environment on server The request is correctly launched and the 14 images are uplaoded.
Notice that I already investigate the timeout response and added this in nginx/sites-enabled
include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; proxy_read_timeout 300s; proxy_connect_timeout 75s;
Thanks for reading
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×