MEAN stack express app receiving 502 proxy error

I have a MEAN stack app deployed to GCP. I set the express app to run on port 80 by using the following in this folder location:

/opt/bitnami/apache2/conf/bitnami/bitnami.conf

ProxyPass / http://127.0.0.1:3000
ProxyPassReverse / http://127.0.0.1:3000

for some reason I am getting a proxy error. I believe it is because of MongoDB. when I go to the sites IP address to see if I can do a GET request the proxy shows up, but when I putty in and go to localhost:3000 the request works there. does any one know why this might be happening?

Hi @shahidfoy,

Did you use any guide to create a custom Node.js application? What did you modify in the /opt/bitnami/apache2/conf/bitnami/bitnami.conf config file?

It is not necessary to include any configuration in that file, you can create a custom file for the Apache configuration related to your application. You can find more information about how to create a new Node.js application on your Bitnami MEAN stack in our guide linked below

https://docs.bitnami.com/aws/infrastructure/mean/administration/create-custom-application-nodejs/

Apart from that, you can’t use port 80 for your Express application because that is the port used by Apache. With the ProxyPass configuration above, Apache will redirect requests on port 80 to the Express port 3000 and vice versa so you can access your application on port 80. Also, as mentioned in the guide, you will need to open port 3000 in Google Cloud to access it directly. You can find more information about it in the link below

https://docs.bitnami.com/google/faq/administration/use-firewall/

Hope it helps,
Gonzalo

So im deploying an angular 7 application but the mean stack you guys currently has only uses angularJS. I decided to turn off apache and set express to port 80

https://medium.com/@shahidfoy/how-to-set-up-angular-7-angular-2-with-express-and-mongodb-on-bitnami-google-cloud-platform-d4a5a1873c1b

yeah i’ll have to look into that document on the GCP to open port 3000
thanks

Hi @shahidfoy,

Let us know if there is anything else we can help you with!

Regards,
Gonzalo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.