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
This policy can be used when a human and/or browser-friendly URL should be transformed into the URL format expected by the web service. This policy only needs to be applied when exposing an alternative URL format, such as clean URLs, RESTful URLs, user-friendly URLs or SEO-friendly URLs that are purely structural URLs that don't contain a query string and instead contain only the path of the resource (after the scheme and the authority). This is often done for aesthetic, usability, or search engine optimization (SEO) purposes.
19
+
Use this policy when you need to transform a human-friendly or browser-friendly URL into the URL format expected by the web service. Apply this policy only when exposing an alternative URL format, such as clean URLs, RESTful URLs, user-friendly URLs, or SEO-friendly URLs that are purely structural and don't contain a query string but instead contain only the path of the resource (after the scheme and the authority). You often make this change for aesthetic, usability, or search engine optimization (SEO) purposes.
|template|The actual web service URL with any query string parameters. Policy expressions are allowed. When expressions are used, the whole value must be an expression. |Yes|N/A|
39
-
|copy-unmatched-params|Specifies whether query parameters in the incoming request not present in the original URL template are added to the URL defined by the rewrite template. Policy expressions are allowed.|No|`true`|
35
+
|copy-unmatched-params|Specifies whether query parameters in the incoming request that aren't present in the original URL template are added to the URL defined by the rewrite template. Policy expressions are allowed.|No|`true`|
40
36
41
37
## Usage
42
38
@@ -46,21 +42,34 @@ This policy can be used when a human and/or browser-friendly URL should be trans
46
42
47
43
### Usage notes
48
44
49
-
You can only add query string parameters using the policy. You can't add extra template path parameters in the rewrite URL.
45
+
You can only add query string parameters by using the policy. You can't add extra template path parameters in the rewritten URL.
46
+
47
+
## Examples
48
+
49
+
### Example 1: Basic URL rewrite
50
+
51
+
In the following example, the public URL is rewritten to match the backend service URL format, and query parameters are included based on other logic.
50
52
51
-
## Example
53
+
- Public URL - `http://api.example.com/storenumber/ordernumber`
In the following example, the public URL is rewritten to match the backend service URL format, and the policy copies any unmatched query parameters to the new URL.
72
+
64
73
```xml
65
74
<!-- Assuming incoming request is /get?a=b&c=d and operation template is set to /get?a={b} -->
66
75
<policies>
@@ -73,7 +82,12 @@ You can only add query string parameters using the policy. You can't add extra t
73
82
</outbound>
74
83
</policies>
75
84
<!-- Resulting URL will be /put?c=d -->
85
+
76
86
```
87
+
### Example 3: Don't copy unmatched parameters
88
+
89
+
In the following example, the public URL is rewritten to match the backend service URL format, and the policy drops any unmatched query parameters.
90
+
77
91
```xml
78
92
<!-- Assuming incoming request is /get?a=b&c=d and operation template is set to /get?a={b} -->
79
93
<policies>
@@ -88,6 +102,20 @@ You can only add query string parameters using the policy. You can't add extra t
88
102
<!-- Resulting URL will be /put -->
89
103
```
90
104
105
+
### Example 4: Use policy expression in the template
106
+
107
+
In the following example, the policy uses expressions in the template to construct the request to the backend.
0 commit comments