Creating a reverse proxy in IIS

I am trying to set up a reverse proxy through IIS to serve a third party JavaScript file on the first hostname. Ive installed the ARR module in IIS and created a URL rewrite rule, but for some reason it is not taking effect. I've also gone into the ARR module in IIS and ensured that "Enable Proxy" was set under the "Proxy Settings" section.

Essentially I need to answer queries on my domain


so far actually serving the file:


My URL rewriting rule looks like this:

<rule name="reverseproxy" stopProcessing="false">
  <match url="^(.*)iojs/(.*)" />
  <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
  <action type="Rewrite" url="{R:2}" appendQueryString="false" />


However, when I pressed


in my browser, I am still getting controller not found exception in MVC.

Update: I noticed that if I change the action type to redirect (301) it works, but this redirects to the client, which is not what I want. To rewrite it I need to make the JS seem to be served from my server.

Has anyone done similar things before, and if so, what step am I missing?


source to share

2 answers

Not sure if it will change anything, but this is the rule I have used with success.

<rule name="ReverseProxy" enabled="true" stopProcessing="true">
  <match url="^(.*)iojs/(.*)" />                  
  <action type="Rewrite" url="{R:2}" appendQueryString="false" logRewrittenUrl="true" />                


Basically the same as yours.

I call it like this:


this will create the following matches:

  • {R:0} /iojs/latest/dyn_wdp.js

  • {R:1} /iojs/latest/dyn_wdp.js

  • {R:2} latest/dyn_wdp.js

for the rule to successfully rewrite:

+ latest/dyn_wdp.js

> 200 OK

Pay attention to the last one in the url, as if you didn't include it, it will result in a bad rewrite:

+ dyn_wdp.js

> 404 Not Found

I only have one rule on the Site, if you do it in a virtual directory then it won't work as expected.

Also, according to this installation guide:

  • Stop IIS by running net stop was and net stop wmsvc in elevated command window

  • Set url rewrite (v2)

  • Install Web Farm Framework (v1)

  • Install ARR (v3)

  • Install the external cache module (v1)

Make sure you have the external cache module (v1.1 for now) as it was not installed in my case.

The recommended way to install ARR 3.0 is via WebPlatform, but no external cache is installed for me. I had to do it myself, not sure if it worked or not.

Also, not sure if you got a controller exception or not only 404 files but .js shouldn't go through ASP.NET MVC.

After all this and with your Regex, everything worked as planned.




I highly recommend using Nodejs on IIS. There NodeJs hooks up an awesome reverse proxy. Once you set up the web than 20 lines of JS code, the rest of the nginx width base is based on.



All Articles