I have an Ember application that is using CORS to access APIs on different subdomains. Since IE8 and IE9 don't have full CORS support I need to create a proxy to access the APIs.
The Ember application is deployed on an Azure Website and the API's are Web Roles. I have tried to create a proxy using URL rewrite but I only get a 404 Not Found.
I would like the following behavior
https://www.cloudstorez.com/rewrite/cms/public/designs
Rewrites to
https://cms-public.cloudstorez.com/designs
The URL rewrite looks like this
<rule name="Rewrite to APIs" stopProcessing="true">
<match url="^rewrite/([^/]*)/([^/]*)/(.*)" />
<action type="Rewrite" url="https://{R:1}-{R:2}.cloudstorez.com/{R:3}" />
</rule>
If I instead do a corresponding redirect it works fine.
<rule name="Redirect to APIs" stopProcessing="true">
<match url="^redirect/([^/]*)/([^/]*)/(.*)" />
<action type="Redirect" url="https://{R:1}-{R:2}.cloudstorez.com/{R:3}" />
</rule>
Is there something wrong in my rewrite or are there restrictions on Azure Websites regarding URL rewrites or accessing other servers?
Rewriting to External URLs is called Reverse Proxy. This functionality is achieved in a combination of ARR + Url Rewrite. These are two separate modules of IIS.
Reverse Proxy is not enabled by default on Azure Web Sites. But there is a trick to enabled it. Ruslan Y. from IIS Team (or former IIS team) has written a blog post on how to enable reverse proxy on Azure Web Sites here.
Note - I haven't personally tested the trick, so cannot say if it still works (Azure Web Sites has much evolved since Ruslan's blog and this feature might have been disabled), but still worth giving it a try.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments