In short. Set Preserve unmatched path to Yes to append the path after the source prefix to the rewrite destination.
Definition: Azure Front Door Standard and Premium use the URL rewrite action to replace a prefix of the request path sent to the origin. Set Preserve unmatched path to Yes when the path after the source pattern must be appended to the new destination path.
Key facts
- Microsoft's Azure Front Door rule set actions reference says that URL rewrite changes the path of a request going to the origin.
- The source pattern uses a prefix-based match, and
/is the value for matching all URL paths. - Only the path after the route configuration's patterns to match is considered for the source pattern.
- The destination path overwrites the source pattern.
- With Preserve unmatched path set to Yes, the remaining path after the source pattern is appended to the new destination path.
- Azure Front Door's route matching documentation checks an exact path before a matching wildcard path and returns a 404 when neither matches.
What does Preserve unmatched path change?
The URL rewrite action has three relevant values: Source pattern, Destination, and Preserve unmatched path. Azure documents Source pattern as a prefix-based match. The destination replaces that matched prefix. When Preserve unmatched path is Yes, Azure appends the path that remains after the source pattern to the destination. When it is No, the destination is used without that remainder.
The action reference shows the configuration shape below. The true value selects the documented Yes behavior.
{
"name": "UrlRewrite",
"parameters": {
"sourcePattern": "/",
"destination": "/redirection",
"preserveUnmatchedPath": true,
"typeName": "DeliveryRuleUrlRewriteActionParameters"
}
}
The source pattern is evaluated against the part of the URL path after the route's Patterns to match value. This route-level prefix therefore affects which characters are available for the rewrite action to match and preserve.
Which path must the route match?
Azure Front Door first selects a route for the incoming request. Its route documentation says a route associates a domain with an origin group. For the path, the service checks an exact match, then a wildcard path, and rejects the request with a 404 Bad Request error if neither produces a match.
For Standard and Premium, the wildcard character * is valid only when it is the final path character and is preceded by /. A path without a wildcard is an exact-match path, and a path ending in / is also an exact-match path. These route rules are separate from the URL rewrite source pattern, which the action reference describes as prefix-based.
After a route is matched, Azure processes its rule set in order. The route documentation states that a rule set can override the origin group for the request. Without a rule set, Azure forwards the request to the origin group without changes.
How do you configure and inspect the rewrite?
In the rule set action, enter the source prefix, enter the destination path, and choose Yes for Preserve unmatched path. Use / as the source pattern when the action must apply to all URL paths considered by the route. The action reference also documents dynamic URL path capture through the {url_path:seg#} server variable and lower or upper case conversion through {url_path.tolower} and {url_path.toupper}.
Inspect the deployed rule definition for the sourcePattern, destination, and preserveUnmatchedPath properties. The request is rewritten on its way to the origin, so the relevant result to check is the path forwarded by Azure Front Door after route selection and rule processing.
Related terms
- How can Azure Front Door ignore selected tracking parameters in its cache key?
- What does Azure Front Door preserve when redirect fields are left empty?
- Why can an Azure Front Door origin override disable caching?
FAQ
Does the rewrite source pattern use a wildcard?
Azure documents the source pattern as prefix-based. The route's wildcard syntax is a separate path-matching feature, while / is the source pattern value that matches all URL paths.
What happens when Preserve unmatched path is set to Yes?
The path remaining after the matched source pattern is appended to the destination path. The setting applies to the URL rewrite action that sends the request toward the origin.
What happens when no route path matches the request?
Azure Front Door checks an exact path and then a matching wildcard path. If it finds neither, the route matching documentation says it rejects the request with a 404 Bad Request error.
Sources
- Microsoft Learn, "Rule set actions", 4 June 2025
- Microsoft Learn, "How requests get matched to a route configuration", 1 May 2026
Check how a page reads to answer engines. Open the GEO score analyzer