I’m new to ARR module. I browsed few sites and implemented the reverse proxy in IIS using ARR & Url rewriting.
My main application(Inventory) was deployed in multiple servers and I have reverse proxy server to access the main application in various servers. Main application in each server will have a local DB and it will have its own data.
Requirement: Client will send the request to reverse proxy, reverse proxy should forward the request to a particular server. And client will interact with that particular server’s application.
To achieve this I deployed the main application(Inventory) with some unique identity prifix as follows,AB1_Inventory, AB2_Inventory
So, when the client request a url to reverse proxy as “http:// reverser_proxy_IP/AB1_Inventory/login.aspx” , it’ll parse the url and map the AB1 and get the actual IP and forward it to the corresponding server (IP). It is working fine without any problem.
Rule:
<rewrite><rewriteMaps><rewriteMap name="IP_Mapping"><add key="AB1" value="172.xx.xxx.178:85" /><add key="AB2" value="132.xx.xxx.208" /></rewriteMap></rewriteMaps><rules><rule name="Proxy for IP"><match url="^([A-Z0-9]*)_(.*)/(.*)" /><conditions><add input="{IP_Mapping:{R:1}}" pattern="(.*)" /></conditions><action type="Rewrite" url="http://{C:1}/{R:0}" /></rule></rules></rewrite>
Now the problem is in production deployment it is not possible to deploy the main application with such prefix(AB_1, AB_2). In production all the servers will have the application insame name “Inventory”. The existing reverse proxy(http:// reverser_proxyIP/AB1_Inventory/login.aspx) is working.
But once the client get the Inventory’s login page and he/she did login the server will redirect the response to “default.aspx” page, at this point the reverse proxy is getting the request as “http:// reverser_proxyIP/Inventory/login.aspx” without any prefix(AB1). So it was not able to do mapping and forward the request to corresponding server/IP.
I have one option to fix this, by adding the prefix code (AB1, AB2,.. ) as query string on every request. So that the request from every server will have the unique code in its request(http:// reverser_proxyIP/Inventory/default.aspx?UniCode=AB1). But this requires code change in the main application(Inventory). I want some generic solution, which can be achieved by doing some config change in reverse proxy.
Please share your Ideas.
</div>