azureazure-front-door

Azure Front Door URL rewrite to lowercase and segment url_path


We have a website https://www.example.com/detail/nameXXX/abcDEF, and we want to redirect to https://www.example.com/detail/abcdef. The rules are blow:

  1. drop the second segment(nameXXX) in url_path.
  2. lowercase the last segment in url_path.

We can use {url_path:seg#} to segment the url_path and use {url_path.tolower} to lowercase the url_path, but how to use one operation to segment and lowercase the url_path??

We tried to use {url_path:seg#.tolower}, {url_path:seg#}.tolower and {{url_path:seg#}}.tolower. All those are useless.


Solution

  • Azure Front Door URL rewrite to lowercase and segment url_path.

    You can create a ruleset in Azure Front Door as shown below to drop the second segment and lowercase the last segment in the url path

    enter image description here

    Configure the destination path as below

    /{url_path:seg0}/{url_path:seg2:99}
    

    After creating the rule, it successfully drops the second segment (nameXXX) in url_path as shown below

    enter image description here