By wode
I am hosting an app using DO’s MEAN droplet. When I was trying to post a specific data using a POST api at the frontend (angularjs), it gives me the below error message.
Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH Failed to load resource: the server responded with a status of 502 (Bad Gateway)
This POST api will save a picture file to the /public directory within the app according to the country folder and also it will update the data to mongodb.
The strange thing is the error only appears when i was doing a POST to one particular country with a picture uploaded. It works fine if i am just posting text data. And after the error appeared, I checked the database the data is updated, but the picture is not saved at that country’s folder. I can get do a GET to that country’s data or picture without issue.
*the POST api is not country specific
When i looked at the nginx log, it says: 2017/03/24 06:53:06 [error] 5309#5309: *66813 upstream prematurely closed connection while reading upstream, client: 175.156.60.170, s$ 2017/03/24 06:53:06 [error] 5309#5309: *66788 connect() failed (111: Connection refused) while connecting to upstream, client: 175.156$ 2017/03/24 06:53:06 [error] 5309#5309: *66788 connect() failed (111: Connection refused) while connecting to upstream, client: 175.156$ 2017/03/24 06:53:06 [error] 5309#5309: *66846 connect() failed (111: Connection refused) while connecting to upstream, client: 175.156$ 2017/03/24 06:53:06 [error] 5309#5309: *66847 connect() failed (111: Connection refused) while connecting to upstream, client: 175.156$
Could anyone tell me what is the issue and how to resolve this? Thank you
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!
Hi—it looks like nginx is unable to connect to your nodejs app. Make sure that it is still running and listening on the same port that nginx is configured to send requests to.
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.