You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Azure Front Door supports URL rewriteto change the request path being routed to your origin. URL rewrite allows you to set conditions to make sure the URL or the specified headers gets rewritten only when certain conditions get met. These conditions are based on the request and response information.
18
+
Azure Front Door provides support for URL rewrite, enabling you to modify the request path that is being routed to your origin. This powerful feature allows you to define conditions that determine when the URL or specified headers should be rewritten. These conditions are based on the information present in the request and response.
19
19
20
-
With this feature, you can redirect your end users to a different origin based on their device types, or the type of file requested. The URL rewrite action can be found in a rule set configuration.
20
+
By using URL rewrite, you have the ability to redirect your end users to different origins based on factors such as their device type or the type of file they're requesting. The URL rewrite action can be easily configured within the rule set, providing you with fine-grained control over your routing behavior.
21
21
22
22
:::image type="content" source="./media/front-door-url-rewrite/front-door-url-rewrite.png" alt-text="Screenshot of URL rewrite action in a rule set configuration.":::
23
23
24
24
## Source pattern
25
25
26
-
The **source pattern**is the URL path in the initial request you want to replace. Currently, source pattern uses a prefix-based match. To match all URL paths, you can define a forward slash (`/`) as the source pattern value.
26
+
The **source pattern**represents the URL path in the initial request that you wish to replace. Currently, the source pattern utilizes a prefix-based matching approach. To match all URL paths, you can specify a forward slash (`/`) as the value for the source pattern.
27
27
28
-
For the source pattern in a URL rewrite action, only the path after the *patterns to match* in the route configuration is considered. For example, you have the following incoming URL format `contoso.com/pattern-to-match/source-pattern`, only `/source-pattern`gets considered by the rule set as the source pattern to be rewritten. The format of the out going URL after URL rewrite gets applied is`contoso.com/pattern-to-match/destination`.
28
+
In the context of a URL rewrite action, only the path after the *patterns to match* in the route configuration is taken into consideration for the source pattern. For instance, the rule set considers only `/source-pattern` as the source pattern to be rewritten if you have an incoming URL format of `contoso.com/pattern-to-match/source-pattern`. After the URL rewrite is applied, the outgoing URL format will be`contoso.com/pattern-to-match/destination`.
29
29
30
-
For situation, when you need to remove the `/pattern-to-match` segment of the URL, set the **origin path** for the origin group in route configuration to `/`.
30
+
In cases where you need to remove the `/pattern-to-match` segment of the URL, you can set the **origin path** for the origin group in the route configuration to `/`.
31
31
32
32
## Destination
33
33
34
-
The destination path used to replace the source pattern. For example, if the request URL path is `contoso.com/foo/1.jpg`, the source pattern is `/foo/`, and the destination is`/bar/`, the content gets served from `contoso.com/bar/1.jpg` from the origin.
34
+
The destination path represents the path that replaces the source pattern. For instance, if the request URL path is `contoso.com/foo/1.jpg`, and the source pattern is `/foo/`, specifying the destination as`/bar/` results in the content being served from `contoso.com/bar/1.jpg` from the origin.
35
35
36
36
## Preserve unmatched path
37
37
38
-
Preserve unmatched path allows you to append the remaining path after the source pattern to the new path. When preserve unmatched path is set to **No** (default), the remaining path after the source pattern gets removed.
38
+
Preserve unmatched path allows you to control how the remaining path after the source pattern is handled. By setting preserve unmatched path to **Yes**, the remaining path is appended to the new path. On the other hand, setting it to **No** (default) will remove the remaining path after the source pattern.
39
+
40
+
Here's an example showcasing the behavior of preserve unmatched path:
39
41
40
42
| Preserve unmatched path | Source pattern | Destination | Incoming request | Content served from origin |
41
43
|--|--|--|--|--|
@@ -49,11 +51,9 @@ Preserve unmatched path allows you to append the remaining path after the source
49
51
50
52
[!INCLUDE [Azure Front Door (classic) retirement notice](../../includes/front-door-classic-retirement.md)]
51
53
52
-
Azure Front Door (classic) supports URL rewrite by configuring a **Custom forwarding path** when configuring the forward routing type rule. By default, if only a forward slash (`/*`) is defined, Front Door copies the incoming URL path to the URL used in the forwarded request. The host header used in the forwarded request is as configured for the selected backend. For more information, see [Backend host header](origin.md#origin-host-header).
53
-
54
-
The robust part of URL rewrite is the custom forwarding path copies any part of the incoming path that matches the wildcard path to the forwarded path.
54
+
Azure Front Door (classic) provides support for URL rewrite by configuring a **Custom forwarding path** when setting up the forward routing type rule. By default, if only a forward slash (`/*`) is defined, Front Door replicates the incoming URL path in the forwarded request. The host header used in the forwarded request is based on the configuration of the selected backend. For more detailed information, see the [Backend host header](origin.md#origin-host-header) documentation.
55
55
56
-
The following table shows an example of an incoming request and the corresponding forwarded path when using a custom forwarding path of `/fwd/` for a match path with a wildcard. The **a/b/c**part of the path represents the portion replacing the wildcard.
56
+
The key aspect of URL rewrite lies in the ability to copy any matching part of the incoming path to the forwarded path when using a custom forwarding path with a wildcard match. The following table illustrates an example of an incoming request and the corresponding forwarded path when utilizing a custom forwarding path of `/fwd/`. The section denoted as **a/b/c** represents the portion that replaces the wildcard match.
@@ -70,9 +70,10 @@ Consider a routing rule with the following combination of frontend hosts and pat
70
70
|| /foo/\*|
71
71
|| /foo/bar/\*|
72
72
73
-
The first column in the following table shows examples of incoming requests and the second column shows what would be the **most-specific** matching route defined. The next three columns in the table are examples of *Custom forwarding paths*.
73
+
The following table illustrates examples of incoming requests and their corresponding most-specific matching routes. It also provides examples of custom forwarding paths and the resulting forwarded paths.
74
+
75
+
For instance, consider the second row of the table. If the incoming request is `www.contoso.com/sub`, and the custom forwarding path is set to `/`, then the forwarded path would be `/sub`. However, if the custom forwarding path is set to `/fwd/`, then the forwarded path would be `/fwd/sub`. The emphasized parts of the paths indicate the portions that are part of the wildcard match.
74
76
75
-
For example, the second row reads, for an incoming request of `www.contoso.com/sub`, if the custom forwarding path is `/`, then the forwarded path would be `/sub`. If the custom forwarding path was `/fwd/`, then the forwarded path is `/fwd/sub`. The **emphasized** parts of the paths represent the portions that are part of the wildcard match.
@@ -89,9 +90,7 @@ For example, the second row reads, for an incoming request of `www.contoso.com/s
89
90
90
91
## Optional settings
91
92
92
-
There are extra optional settings you can also specify for any given routing rule settings:
93
-
94
-
***Cache configuration** - If disabled or not specified, requests that match to this routing rule doesn't attempt to use cached content and instead always fetch from the backend. For more information, see [caching with Azure Front Door](front-door-caching.md).
93
+
**Cache configuration** - If disabled or not specified, requests that match to this routing rule doesn't attempt to use cached content and instead always fetch from the backend. For more information, see [caching with Azure Front Door](front-door-caching.md).
0 commit comments