Dave's Notebook

Azure CDN Blob Storage Case Sensitive Issue

misc_vol4_019 If you’ve done any work with Azure Blob storage, you already know that Blob storage is case sensitive. If you’ve hooked the Azure CDN to blob storage, it is also case sensitive. You are probably reading this article because you’ve already run into this problem. We ran into this problem when we were moving a site from an existing CDN to Azure. The current site was on domain A and the resources hosted by the CDN were on domain B. But the URLs to those resources were in various cases. To make matters worse, there were multiple sites. So it wasn’t a simple matter of just fixing up the case of one site. So we were looking for some way to make the CDN case insensitive, which you can’t do, when I finally thought, “Why don’t we make it so that it doesn’t matter with a response filter?” I’ve done this before when I needed to make global changes and it worked well. Then I remembered, the URL Rewriting module for IIS7 does this for us. And since this module is installed by default on Azure, all we needed to do was:

  • Make everything in blob storage lowercase
  • Install the redirect rules in web.config

Here is the web.config rules:














This will force any URL pointing to http://www.domain.com or http://domain.com to point to http://domain.com and force it all to lowercase on the way back to the client’s browser.