Azure Front Door Premium URL Rewrite Rule Not Matching

Sanal Somasundaran 11 Reputation points

I am currently facing an issue with Azure Front Door Premium while trying to define a URL rewrite rule.

The Front door is to be setup to load static html content from specific folder based

URL accessed.

The format of the url is like https://frontdoor-hostname/{guid}/pagename.html

Here based on the guid value, I am pointing it to specific path on origin group. If the provided guid is not configured, it should fallback to default folder.

Here is the example configuration of route for specific guid


Patterns to match: /29399162-a18f-47d8-9f25-94b64d628fe6/*

Origin Path: /uitemplates/app1

Front door URL: https://frontdoor-hostname/29399162-a18f-47d8-9f25-94b64d628fe6/pagename.html

This will load page from https://origin-hostname/uitemplates/app1/pagename.html

This work perfectly.

Now in cases where such setting doesn’t exist for a guid like say


Default Route:

Patterns to match: /*

Origin Path: /uitemplates/default

This above configuration will send it to https://origin-hostname/uitemplates/default/24e9b7ae-8054-4f83-b548-3ecf45b9bfd5/pagename.html

But I want it to be sent it default folder without guid


I am trying to achieve it using rule set but can’t figure out how to configure it as I can put hardcoded settings there. It should work for any guid as well as any page name requested.

I created below rule set using regular expressions

1 Condition:

   - Match variable: Request Path

   - Operator: Regular expression

   - Value: ^/([0-9a-fA-F-]+)/(.+)$

  1. Action:

   - Action type: URL rewrite

   - Source pattern: /([0-9a-fA-F-]+)/(.*)

   - Destination pattern: /{2}

The rule does not seem to match and apply the rewrite as expected. The GUID part of the URL is not being excluded.

I would greatly appreciate any insights or suggestions on what might be going wrong. Is there a different approach or specific detail I might be missing in the configuration? Any examples or step-by-step guidance would be incredibly helpful.

Thank you in advance for your assistance!

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

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 38,291 Reputation points Microsoft Employee

    @Sanal Somasundaran ,

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

    From your setup, I see you have 2 requirements,

    1. "frontdoor-hostname/nonexistent/pagename.html" should go to "origin-hostname/uitemplates/default/pagename.html"
    2. "frontdoor-hostname/29399162-a18f-47d8-9f25-94b64d628fe6/pagename.html" should go to "origin-hostname/uitemplates/app1/24e9b7ae-8054-4f83-b548-3ecf45b9bfd5/pagename.html"

    I did configure my Lab according to your set up and I was not able to override "Origin Path" by using Rule Sets.

    You can consider not defining any Origin Path in the Request Routing Rules, at all.

    Instead consider,


    • Patterns to match : /*
    • Origin path : <EMPTY>
    • Rule set : ruleset1


    • Patterns to match : /29399162-a18f-47d8-9f25-94b64d628fe6/*
    • Origin path : /uitemplates/app1

    Now, we define the default routing behavior in the ruleset1 applies to Route1,

    • The URL Rewrite Rule should be something like the below,
      • No If Condition, Only Then Action ----> i.e., all the requests to Route1 is Rewritten
      • Source pattern : /
      • Destination : /uitemplates/default/pagename.html
    • This way, all the requests to Route1 are always overwritten to go to "origin-hostname/uitemplates/default/pagename.html"
    • Further more, if you have a group of "guid"s, you can simply add them in patterns to match under Route2

    I did a lab myself and I was able to get the below,

    • User's image
    • As you can see, the default and non-existent GUIDs are going to the default path, "/uitemplates/default/pagename.html"
    • And the valid GUID is going to the "/uitemplates/app1/pagename.html"

    P.S :

    • I understand that your scenario might be a bit more complex and you would like to have the "pagename.html" as dynamic (being index.html or pagename.css)
    • In those cases, you may try to use the Regex as you have mentioned in your query.

    I hope this adds more clarity.



    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.

    0 comments No comments