By yankaled
I’m trying to upload files from an app to a nodejs api on digital ocean using nginx as a reverse proxy. I’m using multer to upload form-data, and it works well in my local environment, so I suppose the problem is with nginx.
I have tried various configurations for nginx.conf and the configuration file at /etc/nginx/sites-available/ (setting client_max_body_size and client_body_buffer_size to larger values, disabling proxy_request_buffering, etc), and even tried the whole process with a 60kb file. I’m not getting the 413 error, so setting larger values for some nginx config variables did work, but the file never appears inside the req object (which multer was supposed to extract).
Any tips on how to solve this problem?
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!
Just in case anyone has this same problem, it was specific to multer. I fixed it by by passing multer as middleware to the router. Interestingly one can use multer directly inside the router function in a local environment without any problems.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.