Report this

What is the reason for this report?

Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH

Posted on March 24, 2017
wode

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!

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.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.