IIS Reverse Proxy to node.js

2019-02-24 12:18发布

问题:

I am trying to configure a reverse proxy so that HTTP calls made from a website hosted in the IIS to node.js applications work.

I'll explain it better:

I've hired a VPS. In this VPS i have a IIS website (simple HTMl + Javascript ) and a node.js application running on localhost:3000. In javascript i make HHTP GET calls to the node.js to obtain some data.

I need to configure a reverse proxy so that the HTTP calls made to node.mydomain.com for example, are internally redirected to localhost:3000.

Example of website's HTTP call:

$.get( "node.mymydomain.com/balance", function( data ) {
  alert( data );
});

After 2 days fighting with IIS, ARR and URL rewrite i am not able to configure it properly and i believe it is not so complicated...

It's the first time i'm using IIS and i need some tips or tutorial...

This is what i've done so far:

  1. I created a server farm called "node" pointing to 127.0.0.1 and in advanced setting i change the HTTP port from 80 to 3000 because that's where my node.js app is running:

  1. I am asked if i want to create a URL Rewrite Rule i click on Yes:

  1. I generate the following Condition:

I add the condition and Route it to my new "node" server farm:

I test on my laptop node.mydomain.com/balance and it is not working.... :S

I really would appreciate some help with this..

Regards,

回答1:

I finally managed to solve this using a reverse proxy (IIS's ARR and URL Rewrite) as it is explained in the following guide:

http://www.gitshah.com/2013/06/how-to-use-iis7-as-front-end-to-java.html