2
votes

I'd like to use path based routing to my azure app service web apps so that

http://mysite.mydomain.com/site1 points to http://mysite1.azurewebsites.net http://mysite.mydomain.com/site2 points to http://mysite2.azurewebsites.net

What is the best way to do this? (I'd like to keep two app services. Not packing two apps in one as virtual directories)

I've tried using Azure Application Gateway which can be configured for this but then I couldn't configure the Web apps to accept traffic from the same custom domain.

In summary this is what I did:

This was enough to make the first route work. Now http://mysite.mydomain.com/site1 happily returns responses from the 1st app service web app.

However, when I did a similar configuration for the second site. The 2nd web app refused to accept the same custom domain as the first one saying:

Hostname is already being used in the following App: mysite1. Please remove the Hostname from mysite1, and try again.

So how do I add the same custom domain to two app service web apps so that they can be used in a scenario like this?

1

1 Answers

2
votes

This is possible by implementing reverse proxy feature via URL rewrite module in Azure web apps. Refer to Ruslan's blog post here: http://ruslany.net/2014/05/using-azure-web-site-as-a-reverse-proxy/

This is a 2 step process:

  1. Enable Reverse Proxy functionality via site extension.
  2. Add a rewrite rule for the reverse proxy to take effect.