DEV Community

loading...

Discussion on: Hosting a Node.js application on Windows with IIS as reverse proxy

Collapse
scottermonk profile image
ScotterMonk

Hi Peter -
Thank you for giving me hope!
I'm getting a 502 Bad Gateway error:
"Web server received an invalid response while acting as a gateway or proxy server."
Windows Server 2016.
Please see attached image of pm2 status of the app.
Oh and how do you determine that port of 3000?
Should I have put "localhost:3000" in that rule or the physical path to my app?
Thanks for any help you can give!

Collapse
petereysermans profile image
Peter Eysermans Author

Hi,

I can't see the image, I think you forgot to link it in your comment. Is the node application accessible on the server itself from localhost:3000? When exactly are you receiving that error?

The port is configured in node. The app.listen statement takes the port on which the node application will listen.

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

If you change that number, the application will listen and be accessible on a different port.