Hay all I´m having a doubt over here and not sure if possible with web.config.
I have a web app in azure . Domain foo.bar.com
is pointing to this webapp.
On the other had I have a CDN as well in azure with a sub domain which is www.foo.bar.com
is pointing to this CDN .
the idea is that foo.bar.com redirects to www.foo.bar.com so to use this CDN.
Right now the picture is:
foo.bar.com > WEBAPP > redirect > www.foo.bar.com > DNS > CDN > webapp
which is causing like to many redirects and sort of endless loop.
Is there a way with web.config to have some rule say something like:
if URL is www.foo.bar.com don´t redirect, stay on webapp. to have something like:
foo.bar.com > WEBAPP > redirect > www.foo.bar.com and that´s it stay on webapp.
Tried something like this but is not working:
<rule name="www" stopProcessing="true">
<match url="https://foo.bar.com" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="https://foo.bar.com" />
</conditions>
<action type="Redirect" url="https://www.foo.bar.com/{R:0}" redirectType="Permanent" />
</rule>