Transform to lowercase incoming URLs in Azure CDN

David Rodriguez 1 Reputation point
2023-01-05T22:30:38.767+00:00

Hi, I hope all if fine.
I created a static website using Azure Blob Storage and Azure CDN services. All files and folders are in lowercase format; however, some requests are coming with uppercase characters. Is it possible to transform all incoming requests to lowercase using Azure CDN rules engine? Can you provide an example? Your help is much appreciated.

Azure Content Delivery Network
{count} votes

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 46,261 Reputation points Microsoft Employee
    2023-02-22T15:00:25.3866667+00:00

    Hello @David Rodriguez ,

    I understand that you created a static website using Azure Blob Storage and Azure CDN Premium from Verizon, where all files and folders are in lowercase format, however, some requests are coming with uppercase characters, and you would like to know if it is possible to transform all incoming requests to lowercase using Azure CDN rules engine.

    Yes, it is possible to transform all Azure CDN requests coming with uppercase characters to lowercase using the Azure CDN Premium from Verizon rules engine as you've shown in your comment above. I've tested this in lab, and it works:

    I created a static website using Azure Blob Storage and Azure CDN Premium from Verizon and then added the below rule to the Azure CDN Premium from Verizon rules engine under HTTP Large:

    User's image

    Now, when I browse the CDN endpoint with some uppercase letters in the request, it doesn't give me an error and I'm able to browse the site:

    User's image

    This rewrite rule works as I'm able to access the site even with uppercase letters in the request but the URL in the browser doesn't change to lowercase.

    So, you need to keep the below points in mind:

    • If you do a URL rewrite, CDN rewrites the URL before the request is sent to the backend. This won't change what users see in the browser because the changes are hidden from the user.
    • If you do a URL redirect, CDN sends a redirect response to the client with the new URL. That, in turn, requires the client to resend its request to the new URL provided in the redirect. The URL that the user sees in the browser will update to the new URL.

    Now, if your end goal is to transform the request to lowercase in the browser itself, then you need to do a URL redirect.

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments