Mod Proxy equivalent in IIS using ARR and URL Rewrite Module

IIS7 is quite modular, it is shipped with lots of goodies as separate modules and together it is now one of the most powerful and flexible web server.

In this post I intent to cover how we can easily configure ARR and URL Rewrite Module to get a similar functionality as of Mod Proxy in Apache.

Here I will demonstrate configuration of a reverse proxy which according to the definition is

Reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers.
A general use case to configure such proxies could be to handle cross domain Ajax requests, so basically if I would like to call a service hosted as from http://localdomain/service I would need to configure a proxy which will request resources from on behalf of localdomain


STEP 1: To set up a rule click on the web application from the sites tree on the left and then click on the URL Rewrite module, then form the command pallete on the right hand click on Add Rule as shown in image below.
STEP 2: From the add rule dialog choose reverse proxy template

Configure Inbound Rules window and provide server name as shown in screen shot below

Finally configure the last form, this is where one can specify cache parameters and override server header variables, such as basic authentication (http_authorisation) etc.


In the patterns text box entering something like ^/service(.*) will trap all requests going to http://localdomain/service and they will be proxyed as if the requests were made like , The query strings if present are also carried forward, all these settings and modification are preserved in web.config of the web application, under tag. The rules after configuration look like

        <rule stopprocessing="true" name="ReverseProxyInboundRule1">
            <match url="^service/(.*)" />
            <action url="{R:1}" type="Rewrite" />
            <servervariables />

If desired server variables and cache params can also be included.

Apart form using the reverse proxy template one can directly use url re-write module and even import settings from apache . Read here for more information.

I hope you will find this post use full. Happy coding ;)


Mod Proxy equivalent in IIS using ARR and URL Rewrite Module  by  admin