DEV Community

loading...

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

Collapse
petereysermans profile image
Peter Eysermans Author

Is there a reason why the build touches the web.config? The web.config is configure once and then forget. You could build your node.js application in another folder to avoid the build changing the web.config file for the reverse proxy.

I have not encountered this problem myself.

Collapse
stelco profile image
Steven Collins • Edited

Yes because I have IIS pointing to the build folder to run the app. There is a reverseProxy URL rewrite rule set in IIS which gets saved in the build folder.

web.config in build folder looks like this...
thepracticaldev.s3.amazonaws.com/i...

Could it be moved into the root of the project..? Im not sure how to edit it to do this.

Thread Thread
petereysermans profile image
Peter Eysermans Author

It might work if you move it into another folder and change the basic settings of the IIS website to the new folder? That way the node application can run via pm2 from the build folder and IIS is pointing to the other folder. The web.config is then never changed by the build.

Thread Thread
stelco profile image
Steven Collins • Edited

OK thanks I will try this when I get a chance.
Another issue im having which you may be able to help with is that we use a Virtual Machine to host the front end of our website. After installing PM2 globally under my login (the one I use to log on remotely to start a session), I am finding that PM2 only runs once I start a new session because the servers are only available up until 10pm and then restart at 7am. This means I have to start a new session each morning before PM2 starts and therefore starts the Express server. Ive also tried installing PM2 as a dependency in my project but not having much luck with it. Thanks.

Thread Thread
petereysermans profile image
Peter Eysermans Author

I am currently looking into this myself. There is a npm package but I still have to try it out myself. This Stackoverflow question might also give some answers.