Azure front Door url rewriting

Arthur(Xueli) Wang 20 Reputation points
2025-02-05T01:52:21.3766667+00:00

We are migrating from Azure CDN to Azure Front Door and are encountering URL rewrite issues. Previously, in CDN, we could use (.*) to replace the matched content with a new address, while preserving any unmatched content and appending a SAS token to the end. Now, we must use {url_path:seg#} to match the corresponding content. For example, /content/* needs to be rewritten to /media/pdf/*?<SAS token>. How can we achieve this in Azure Front Door?

Thanks

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
750 questions
{count} votes

Accepted answer
  1. Rohith Vinnakota 2,690 Reputation points Microsoft Vendor
    2025-02-05T07:30:08.6133333+00:00

    Hi @Arthur(Xueli) Wang,

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

    I did a lab and I was successfully able to achieve this.

    User's image

    ADF logs

    User's image

    • As you can see, the original request from client was <AFDEndPoint>/content/HTML/index.html?<SASToken>
    • But the request that went to the Storage Account was <StorageAccountName>.blob.core.windows.net:443/content/HTML/index.html?<SASToken>
    • {url_path:seg#}: Allow users to capture and use the desired URL path segment in URL Redirect, URL Rewrite, or any meaningful action.For a multiple-segment capture, when the source pattern is /id/12345/default/location/test, a URL rewrite destination /{url_path:seg1:3}/home results in /12345/default/location/home.

    For more information,

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

    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.

    1 person found this answer helpful.
    0 comments No comments

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.