I am unsure where to find the error (attached the screenshots below).
So Upon trying to upload large files through a Droplet, Ubuntu, Nginx, Nodejs I am hitting a 413 Request Entity Too Large
error.
Connection: keep-alive
Content-Length: 67
Content-Type: text/html
Date: Mon, 29 May 2023 21:27:18 GMT
Server: nginx/1.22.0 (Ubuntu)
X-Powered-By: Express
In the response headers I get :
Server:
nginx/1.22.0 (Ubuntu)
X-Powered-By:
Express
which tells me (I think) it’s coming from Nginx config (image/link below). In the /etc/nginx/nginx.conf
I have within the http
block client_max_body_size 200M
however i’m still getting this 413 error.
So I’m unsure, is the error coming from Nginx and the client_max_body_size
is not being picked up/listened too OR is there a limit on a single upload request and DigitalOcean is hitting some limit, I’m unsure how to have a definite answer, since I can assume it’s nginx but with the config looking correct I am unsure if it’s still nginx or DO.
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Heya,
If you’re receiving a “413 Request Entity Too Large” error, it typically originates from Nginx, as this error message is indicative of the Nginx server refusing to process the request because the request body exceeds the size limit defined in its configuration.
Here are a few troubleshooting steps to help you narrow down and hopefully resolve the problem:
Nginx Configuration:
Ensure you’ve modified the correct Nginx configuration file. Nginx can have multiple config files, especially if you’re using virtual hosts. Check your server block or virtual host configuration files, typically located in
/etc/nginx/sites-available/
or/etc/nginx/conf.d/
.If you’ve modified the
client_max_body_size
within a specific server block, ensure it’s not being overridden elsewhere.After making changes, always remember to reload or restart Nginx:
Nginx Includes:
Nginx supports including other configuration files. Check if there are any additional configuration files being included that might be overriding your settings.
Proxy & Buffers:
If your Nginx is acting as a reverse proxy for a backend server (like Express), ensure you also configure the buffer sizes:
Express/Node.js Configuration:
While the error message format you’ve shown is typical of Nginx, you should also check if there’s any body size limit set in your Express/Node.js application, especially if you’re using body parsers. For instance, with
body-parser
, you can set a limit:Logs:
Check Nginx’s error logs for any relevant messages that could offer more insights:
Hi there,
With Nginx installed on a Droplet, there are no limits implied by DigitalOcean. This would only be the case for the App Platform.
With a Droplet, you have root access and you can adjust any of the configurations that you need.
What I could suggest checking the site-specific Nginx configuration under
/etc/nginx/sites-available/
. As if you have anyclient_max_body_size
definitions in there this will override the ones that you’ve specified in thehttp
directive.Also, after making changes to the NGINX configuration, remember to restart or reload the service for the changes to take effect. You can do this by running
sudo systemctl reload nginx
orsudo service nginx reload
.Also, how large is the file that you are trying to upload?
And do you see any other errors in the Nginx error log:
Best,
Bobby