Azure Front Door is a global entry point service for websites. Including features like DDOS, WAF, website failover. I have introduced it in "A Brief Introduction for Azure Front Door". This article specifically introduces the usage of URL redirection in Azure Front Door.

When to do URL redirection

URL redirection is mainly used to redirect users to a new location of a resource. The most common case is that the URL of the resource has changed, and the old URL in the search engine, other websites, or the user's browser favorites has not been updated. At this time, if any one try to visit the old URL, it will result in 404. Therefore, we can redirect the old URL to the new URL through URL redirection to ensure that the user can continue to visit it.

Take my blog as an example. My early RSS subscription URL was:

But later changed to

However, a large number of users' RSS readers did not update their subscription addresses, so a large number of 404 requests were observed on Azure Application Insights. At this time, URL redirection is required.

In addition, when a website is migrated to a new domain name, URL redirection is also required to ensure that resources are continuously accessible. When facing some sudden marketing events, URL redirection can be used to prevent users from accessing certain web pages, which is also the fastest way to respond.

Why do URL redirects on Front Door

For a website, we can do URL redirection and URL rewriting in many ways. For example, ASP.NET Core's built-in URL Rewrite middleware, IIS's URL Rewrite module, or even write your own code implementation. In an enterprise environment, we can also configure URL redirection and URL rewriting on network products such as F5 BIG-IP. But buying F5 is a huge expense, now that you've already bought Azure, you can use the features provided by Azure Front Door, allowing us to redirect or rewrite URLs without modifying the site configuration or source code.

Configure URL redirection rules

Resource location changes under the same domain name

Take the RSS URL redirection of my blog. I need to redirect /subscription/rss to /rss.

Open Front Door Designer and click + above the Routing rules.

Enter a Name.

You can chooses HTTP or HTTPS or both depending on your needs, and since my blog is only accessible to HTTPS, I'll choose HTTPS only here.

Enter /subscription/rss in PATTERNS TO MATCH, you can also use * to match anything.

Choose Redirect for Route type

Choose Moved (301) for Redirect type

Set Destination path as Replace, and enter /rss as value

Save your changes and wait a few minutes. Now access to will automatically jump to while my website itself doesn't need to make any code change.

Jump to another domain name

Still take my blog as example, I don't want users to access my site through Azure Front Door's default domain name, but the default domain name can't be deleted, so I can only let the user jump to the primary domain name. For example, will automatically redirect to

To do this, you need to:

Remove domain names that you do not want users to access from other rules, such as

Create a new rule and select this domain name in Frontends/domains. Leave /* in PATTERNS TO MATCH

I selected 302 in Redirect type. The difference between 301 and 302 is that 302 indicates that the redirect is temporary, but 301 indicates that the migration of resources is permanent. When a search engine sees 302, it doesn't update the original URL in it's database, but when it sees a 301, the URL record will be updated. 

Select Replace in Destination host and enter the target domain.

Save the rule and wait a few minutes, access to is now jumped to the primary domain name.

Learn more about Azure Front Door: