In Azure all hosted sites have URL Rewrite and ARR (Application Request Routing) modules installed but the proxy functionality is disabled by default in ARR.
So, when you create a simple rewrite rule like the one that follows:
<rewrite> <rules> <rule name="ProxyAdmin" stopProcessing="true"> <match url="backend/api(.*)" /> <action type="Rewrite" url="http://api.yourdomain.com/api/{R:1}" logRewrittenUrl="false" /> </rule> </rules> </rewrite>
where, for example all the requests like `http://www.yourdomain.com/backend/api/…` should be served by `http://api.yourdomain/api/…` will result in a 404 (Not Found) status code with the following message:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
To overcome this issue and enable proxy functionality, we should follow three simple steps:
Step 1: Create an xdt transform file
<?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>
This file will override applicationhost.config, taking advantage of a feature in Azure, called Azure Site Extensions, that provides a mechanism to apply transforms to applicationhost.config using XDT transforms.
Step 2: Upload applicaitonHost.xdt to `site` directory of your web app
Step 3: Restart your web app for changes to take effect
Thanks. This helped a lot!