Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

502 Bad Gateway with nginx | Google App Engine | Node JS

I am hosting the web app on Google Cloud Platform with App Engine and I am using ExpressJS and MongoDB, which is hosted on mLab.

Everything worked well until 1/1/2017. I had vm:true before and now was forced to change the env to flex. Now I am getting 502 bad gateway error with nginx. App engine doesn't allow us to change the nginx config file.

I had tried the suggestion from this post: Google App Engine 502 (Bad Gateway) with NodeJS but still doesn't work.

For some reason, I have another app with exactly the same setting on app engine and it works perfectly.

Any suggestion will be greatly appreciated. Thank you.

like image 560
NodejsNewbie Avatar asked Jan 04 '17 19:01

NodejsNewbie


People also ask

What causes 502 Bad gateway nginx?

In more technical words, A 502 Bad Gateway means that the proxy (gateway) server wasn't able to get a valid or any response from the upstream server. If you are seeing a 502 bad gateway error on a website, it means that the origin server sent out an invalid response to another server that acted as a gateway or proxy.

Will 502 bad gateway go away?

If the error persists, there is a chance that your browser cache has saved outdated and corrupted files. In this case, clearing the browser cache can fix an HTTP 502 Bad Gateway error.


1 Answers

app should always listen to port 8080, google forwards all request from 80 to 8080 https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#listen_to_port_8080

like image 160
Deepak Patil Avatar answered Sep 27 '22 02:09

Deepak Patil