1

I have a website on azure. Then I've created a CDN. I've a custom domain to my cdn. Now I have added this configuration on my website:

<system.webServer>
  <rewrite>
    <rules>        
      <rule name="RedirectToDomain" stopProcessing="true"  patternSyntax="Wildcard">
        <match url="*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="mysite-app-net47-test-westeu.azurewebsites.net" />
        </conditions>
        <action type="Redirect" url="https://test.mysite.com/{R:0}" />
      </rule>
    </rules>
  </rewrite>
  ...
</system.webServer> 

where https://test.mysite.com/ is a custom domain of my cdn :

enter image description here

But now I get this error:

enter image description here

I deleted cookies, I purge the cache... but I have not solved. I have tried to check redirect via redirect path and i get this:

(first time):

enter image description here

and then always:

enter image description here

Here the request traced with fiddler... both look likes equal:

enter image description here

The question seems get changed instead (the second is the request toward the cdn):

enter image description here

How can I solve?

Thank you

Simone
  • 2,304
  • 6
  • 30
  • 79
  • I guess the CDN is making a request through the Azure websites domain name, which returns a 301 -> which the CDN returns to the user -> repeat. Maybe there is some header that the CDN applies that you could check for here? So you don't redirect if it's the CDN? – juunas Mar 04 '21 at 10:23
  • @juunas I have edited the question... yes it seems there is a little difference in the header... so, what can I check to block redirect? – Simone Mar 04 '21 at 10:35
  • Those look like _response_ headers that you receive. I mean the CDN service is making an HTTP request to your Web App and it might include a _request_ header that would allow you to filter those requests. You could temporarily remove the redirect config and then try to see if you can log request headers received by your app. – juunas Mar 04 '21 at 11:00
  • @juunas I have updated again the question – Simone Mar 04 '21 at 11:36
  • this is the only difference I see between requests: `:authority: test.xxx.com` and `:authority: xxx-app-net47-test-westeu.azurewebsites.net` – Simone Mar 04 '21 at 13:51

0 Answers0