Reputation: 615
I have a domain like example.com, and I also have a website hosted in Azure called mysite1.azurewebsites.net for example.
Now all the traffic from live.example.com goes to mysite1.azurewebsites.net. We point custom domain name to our Windows Azure website. I want to use reverse proxy technology to redirect some requests (e.g requests from client A) to mysite2.azurewebsites.net, and other requests from other clients still go to mysite1.azurewebsites.net. All these should happen after they login. (live.example.com is a login page)
Client A live.example.com ======> mysite2.azurewebsites.net
Client B live.example.com ======> mysite3.azurewebsites.net
Client C live.example.com ======> mysite4.azurewebsites.net
Other Clients live.example.com ======> mysite1.azurewebsites.net
Is this possible to achieve using Reverse Proxy with ARR? If yes, how?
Thank you
Upvotes: 1
Views: 1035
Reputation: 7402
This blog post explains how you can do that http://ruslany.net/2014/05/using-azure-web-site-as-a-reverse-proxy/
To summarize, on live.example.com
you need to set an xdt transform that looks like this
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="false" reverseRewriteHostInResponseHeaders="false" />
</system.webServer>
</configuration>
Then you'll need to set a URL Rewrite rule that does the mapping you want. If you plan on using UserAgent for example as what tells you the client name then it'll be something like this
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ClientA">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="Client A" />
</conditions>
<action type="Rewrite" url="https://mysite2.azurewebsites.net/{R:1}" />
</rule>
<rule name="ClientB">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="Client B" />
</conditions>
<action type="Rewrite" url="https://mysite3.azurewebsites.net/{R:1}" />
</rule>
<rule name="ClientC">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="Client C" />
</conditions>
<action type="Rewrite" url="https://mysite4.azurewebsites.net/{R:1}" />
</rule>
<rule name="Others" stopProcessing="true">
<match url="^(.*)$" />
<action type="Rewrite" url="https://mysite1.azurewebsites.net/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Upvotes: 2