Skip to content

Commit 3d5d256

Browse files
made formatting changes
1 parent be684db commit 3d5d256

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

articles/frontdoor/rule-set-server-variables.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ When you use [Rule set match conditions](rules-match-conditions.md), server vari
1818
When you use [Rule set actions](front-door-rules-engine-actions.md), you can use server variables to dynamically change the request and response headers, and rewrite URLs, paths, and query strings, for example, when a new page load or when a form gets posted.
1919

2020
> [!NOTE]
21-
> Server variables are available with Azure Front Door Standard and Premium tiers.
21+
> Server variables are only available with Azure Front Door Standard and Premium tiers.
2222
2323
## Supported variables
2424

@@ -54,16 +54,22 @@ When you work with Rule Set actions, specify server variables by using the follo
5454
* Zero lengths: `{var:0:0}` = null, `{var:4:0}` = null
5555
* Offsets within range and lengths out of range: `{var:0:100}` = `AppId=01f592979c584d0f9d679db3e66a3e5e`, `{var:5:100}` = `=01f592979c584d0f9d679db3e66a3e5e`, `{var:0:-48}` = null, `{var:4:-48}` = null
5656
* To experiment with how {variable:offset:length} works, open a Linux bash terminal or use bash terminal in [Azure Cloud Shell](https://shell.azure.com/). Enter the following example into the terminal and examine the output to understand how the substring extraction behaves.
57+
5758
```azurecli-interactive
58-
>>variable=helloworld123
59-
>>echo ${variable:5}
60-
world123
61-
>>echo ${variable:0:4}
62-
hell
63-
>>echo ${variable: -3:3} # In bash, space comes before negative numbers.
64-
123
65-
>>echo ${variable:5: -3}
66-
world
59+
variable=helloworld123; echo ${variable:5} #Output = world123
60+
```
61+
```azurecli-interactive
62+
variable=helloworld123; echo ${variable:0:5} #Output = hello
63+
```
64+
> [!NOTE]
65+
> In Bash, a space is required before a negative number in parameter expansion to avoid syntax errors.
66+
67+
```azurecli-interactive
68+
variable=helloworld123; echo ${variable: -3:3} #Output=123
69+
```
70+
71+
```azurecli-interactive
72+
variable=helloworld123; echo ${variable:5: -3} #Output = world
6773
```
6874

6975
* `{url_path:seg#}`: Allow users to capture and use the desired URL path segment in URL Redirect, URL Rewrite, or any meaningful action. User can also capture multiple segments by using the same style as substring capture `{url_path:seg1:3}`. For example, for a source pattern `/id/12345/default` and a URL rewrite Destination `/{url_path:seg1}/home`, the expected URL path after rewrite is `/12345/home`. For a multiple-segment capture, when the source pattern is `/id/12345/default/location/test`, a URL rewrite destination `/{url_path:seg1:3}/home` results in `/12345/default/location/home`. Segment capture includes the location path, so if route is `/match/*`, segment 0 will be match.

0 commit comments

Comments
 (0)