Azure CDN - URL rewrite rule to remove part of the url

Cesar Albusac Jorge 25 Reputation points
2024-12-12T09:18:04.6666667+00:00

Hello,

I looked at https://learn.microsoft.com/en-us/answers/questions/138148/front-door-remove-part-of-a-url-path but it didn't specify how to create the rule.

I created an Azure Content Delivery Network (Pricing Tier Microsoft CDN classic).

I want to rewrite the URL if it contains a string, i.e. test.

So from

https://mycdn.azureedge.net/test/container1/myfile.txt

I want the URL to be rewritten as:

https://mycdn.azureedge.net/container1/myfile.txt

So it will find the file.

I have tried these 3 rules so far, no luck:
Test1

Test2

Test3

Any help would be appreciated.

Thanks a million

Azure Content Delivery Network
0 comments No comments
{count} votes

Accepted answer
  1. Ganesh Patapati 2,590 Reputation points Microsoft Vendor
    2024-12-12T15:12:31.6433333+00:00

    Hi Cesar Albusac Jorge

    Greetings!

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    It appears you are working on creating a URL rewrite rule in Azure Content Delivery Network (CDN) to eliminate a specific string from the URL path.

    User's imageYou can refer the below stepsStep1: Configure the URL rewrite rule

    1. Select "URL path" as the condition type.
    2. Enter the following condition:
      • Operator: "Contains"
      • Value: "/test/"
      • Case transform: No transform

    Step2: Select "URL rewrite" as the action type.

    1. Enter the following action:
      • Source Pattern: "/test/*"
      • Destination: "/*"

    Preserve unmatched path: Yes

    NOTE: This rule checks if the URL path contains /test/ and then rewrites the path by removing /test/ while preserving the rest of the path.

    If you are still encountering issues, kindly provide additional details regarding the error messages in terms of Screenshot manner or the behavior you are experiencing.


    Hope this clarifies!

    If above is unclear and/or you are unsure about something add a comment below.

    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    Regards,

    Ganesh


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.