Question

I get "413 Entity too large" then "502 Bad Gateway" after I increased

Posted March 10, 2020 67 views
NginxUbuntu

Hello,

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 client
maxbodysize to 10 Mb in nginx.conf
https://datanextsolutions.com/blog/how-to-fix-nginx-413-request-entity-too-large-error/

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

0 answers
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!