/Software Development

Azure CDN - InvalidUri Errors

While migrating this site to an Azure Static Website, I attempted to set up an Azure CDN for HTTPS with my custom domain (althought there are many other reasons to use a CDN). And, as luck would have it, I got to experience first-hand one of the risks of using Azure CDN as noted in the best practices documentation—it’s a single point of failure!

When I set up another website, I experienced the typical wait times when creating a brand new site (i.e. waiting for DNS settings to propagate). Within a day, everything was up and running, with the Azure CDN address resolving to my Static Website, and my domain resolving to the CDN address.

However, when I followed the same steps to set up this website, I got a nasty XML error response:

<Error>
<Code>InvalidUri</Code>
<Message>
The request URI is invalid. RequestId:1aa68e7e-001e-0021-6641-7a6844000000 Time:2019-10-03T23:21:41.4227879Z
</Message>
</Error>

After waiting a day and “turning it off and turning it on again” (both the CDN and the static website), I finally resorted to contacting Microsoft Support. They informed me that the Azure CDN service was experiencing a known failure that was affecting multiple customers in multiple regions! All I could do was wait until they fixed it, and check periodically.

After more than 24 hours has passed, I was still experiencing this problem (and my other websites with the same architecture was working fine). I opened up another support chat, and apparently things were still broken.

support chat screenshot.png

“Have you tried deleting it and recreating it?” is the cloud version of “Have you tried turning it off and turning it on again?”

The support agent suggested I try recreating the CDN endpoint. This isn’t a great solution, in my opinion, but I figured I can just create another one side-by-side to the existing endpoint and let them race for which one comes up first. After a few minutes, I loaded the new CDN endpoint.

not found screenshot

This error page is at least better than a nasty XML error, so… progress?

After maybe 15 minutes (or however long it takes to eat a snack and drink some tea)…SUCCESS! My static website loaded at the CDN endpoint!

Now, all that’s left is to delete the old CDN resource and update my DNS to point at the newly created and working endpoint, and everything should be good to go (fingers crossed). If it happens to you, just try creating a new one without waiting for things to fix themselves.

Bogdan Varlamov

Bogdan Varlamov

I believe technology makes life more worthwhile :)

Read More