Skip to content

Commit ec22a69

Browse files
committed
freshness review
1 parent 24a879c commit ec22a69

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

articles/cdn/cdn-http-variables.md

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
title: HTTP variables for Azure CDN rules engine | Microsoft Docs
33
description: Learn about HTTP variables, which allow you to get HTTP request and response metadata for some rules engine features. Use metadata to alter a request/response.
44
services: cdn
5-
documentationcenter: ''
65
author: duongau
7-
manager: danielgi
8-
editor: ''
9-
10-
ms.assetid:
6+
manager: kumudd
117
ms.service: azure-cdn
128
ms.workload: tbd
139
ms.tgt_pltfrm: na
1410
ms.topic: article
15-
ms.date: 05/09/2018
11+
ms.date: 02/27/2023
1612
ms.author: duau
1713

1814

@@ -32,11 +28,11 @@ The following table describes the supported HTTP variables. A blank value is ret
3228

3329
| Name | Variable | Description | Sample value |
3430
| ---- | -------- | ----------- | ------------ |
35-
| ASN (Requester) | %{geo_asnum} | Indicates the requester's AS number. <br /><br />**Deprecated:** %{virt_dst_asnum}. <br />This variable has been deprecated in favor of %{geo_asnum}. Although a rule that uses this deprecated variable will continue to work, you should update it to use the new variable. | AS15133 |
31+
| ASN (Requester) | %{geo_asnum} | Indicates the requester's AS number. <br /><br />**Deprecated:** %{virt_dst_asnum}. <br />This variable has been deprecated in favor of %{geo_asnum}. Although a rule that uses this deprecated variable continues to work, you should update it to use the new variable. | AS15133 |
3632
| City (Requester) | %{geo_city} | Indicates the requester's city. | Los Angeles |
37-
| Continent (Requester) | %{geo_continent} | Indicates the requester's continent through its abbreviation. <br />Valid values are: <br />AF: Africa<br />AS: Asia<br />EU: Europe<br />NA: North America<br />OC: Oceania<br />SA: South America<br /><br />**Deprecated:** %{virt_dst_continent}. <br />This variable has been deprecated in favor of %{geo_continent}. <br />Although a rule that uses this deprecated variable will continue to work, you should update it to use the new variable.| N/A |
33+
| Continent (Requester) | %{geo_continent} | Indicates the requester's continent through its abbreviation. <br />Valid values are: <br />AF: Africa<br />AS: Asia<br />EU: Europe<br />NA: North America<br />OC: Oceania<br />SA: South America<br /><br />**Deprecated:** %{virt_dst_continent}. <br />This variable has been deprecated in favor of %{geo_continent}. <br />Although a rule that uses this deprecated variable continues to work, you should update it to use the new variable.| N/A |
3834
| Cookie Value | %{cookie_Cookie} | Returns the value corresponding to the cookie key identified by the Cookie term. | Sample Usage: <br />%{cookie__utma}<br /><br />Sample Value:<br />111662281.2.10.1222100123 |
39-
| Country/Region (Requester) | %{geo_country} | Indicates the requester's country/region of origin through its country/region code. <br />**Deprecated:** %{virt_dst_country}. <br /><br />This variable has been deprecated in favor of %{geo_country}. Although a rule that uses this deprecated variable will continue to work, you should update it to use the new variable. | US |
35+
| Country/Region (Requester) | %{geo_country} | Indicates the requester's country/region of origin through its country/region code. <br />**Deprecated:** %{virt_dst_country}. <br /><br />This variable has been deprecated in favor of %{geo_country}. Although a rule that uses this deprecated variable continues to work, you should update it to use the new variable. | US |
4036
| Designated Market Area (Requester) | %{geo_dma_code} |Indicates the requester's media market by its region code. <br /><br />This field is only applicable to requests that originate from the United States.| 745 |
4137
| HTTP Request Method | %{request_method} | Indicates the HTTP request method. | GET |
4238
| HTTP Status Code | %{status} | Indicates the HTTP status code for the response. | 200 |
@@ -57,7 +53,7 @@ The following table describes the supported HTTP variables. A blank value is ret
5753
| Request Protocol | %{request_protocol} | Indicates the request protocol. | HTTP/1.1 |
5854
| Request Scheme | %{scheme} | Indicates the request scheme. |http |
5955
| Request URI (Relative) | %{request_uri} | Indicates the relative path, including the query string, defined in the request URI. | /marketing/foo.js?loggedin=true |
60-
| Request URI (Relative without query string) | %{uri} | Indicates the relative path to the requested content. <br /><br/>Key information:<br />- This relative path excludes the query string.<br />- This relative path reflects URL rewrites. A URL will be rewritten under the following conditions:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- URL Rewrite Feature: This feature rewrites the relative path defined in the request URI.<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Edge CNAME URL: This type of request is rewritten to the corresponding CDN URL. |/800001/corigin/rewrittendir/foo.js |
56+
| Request URI (Relative without query string) | %{uri} | Indicates the relative path to the requested content. <br /><br/>Key information:<br />- This relative path excludes the query string.<br />- This relative path reflects URL rewrites. A URL is rewritten under the following conditions:<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- URL Rewrite Feature: This feature rewrites the relative path defined in the request URI.<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Edge CNAME URL: This type of request is rewritten to the corresponding CDN URL. |/800001/corigin/rewrittendir/foo.js |
6157
| Request URI | %{request} | Describes the request. <br />Syntax: &lt;HTTP method&gt; &lt;relative path&gt; &lt;HTTP protocol&gt; | GET /marketing/foo.js?loggedin=true HTTP/1.1 |
6258
| Response Header Value | %{resp_&lt;ResponseHeader&gt;} | Returns the value corresponding to the response header identified by the &lt;ResponseHeader&gt; term. <br /><br />If the name of the response header contains a dash (for example, User-Agent), replace it with an underscore (for example, User_Agent). | Sample Usage: %{resp_Content_Length}<br /><br />Sample Value: 100 |
6359

@@ -90,11 +86,11 @@ The delimiters are described in the following table.
9086

9187
| Delimiter | Description |
9288
| --------- | ----------- |
93-
| := | Indicates that a default value will be assigned to the variable when it is either: <br />- Missing <br />- Set to NULL. |
94-
| :+ | Indicates that a default value will be assigned to the variable when a value has been assigned to it. |
95-
| : | Indicates that a substring of the value assigned to the variable will be expanded. |
96-
| # | Indicates that the pattern specified after this delimiter should be deleted when it is found at the beginning of the value associated with the variable. |
97-
| % | Indicates that the pattern specified after this delimiter should be deleted when it is found at the end of the value associated with the variable. <br />This definition is only applicable when the % symbol is used as a delimiter. |
89+
| := | Indicates that a default value is assigned to the variable when it's either: <br />- Missing <br />- Set to NULL. |
90+
| :+ | Indicates that a default value is assigned to the variable when a value has been assigned to it. |
91+
| : | Indicates that a substring of the value assigned to the variable is expanded. |
92+
| # | Indicates that the pattern specified after this delimiter should be deleted when it's present at the beginning of the value associated with the variable. |
93+
| % | Indicates that the pattern specified after this delimiter should be deleted when it's present at the end of the value associated with the variable. <br />This definition is only applicable when the % symbol is used as a delimiter. |
9894
| / | Delimits an HTTP variable or a pattern. |
9995
| // | Find and replace all instances of the specified pattern. |
10096
| /= | Find, copy, and rewrite all occurrences of the specified pattern. |
@@ -108,11 +104,11 @@ The following table describes circumstances under which the specified text isn't
108104

109105
| Condition | Description | Example |
110106
| --------- | ----------- | --------|
111-
| Escaping % symbol | The percentage symbol can be escaped through the use of a backslash. <br />The sample value to the right will be treated as a literal value and not as an HTTP variable.| \%{host} |
107+
| Escaping % symbol | The percentage symbol can be escaped by using a backslash. <br />The sample value to the right is treated as a literal value and not as an HTTP variable.| \%{host} |
112108
| Unknown variables | An empty string is always returned for unknown variables. | %{unknown_variable} |
113109
| Invalid characters or syntax | Variables that contain invalid characters or syntax are treated as literal values. <br /><br />Example #1: The specified value contains an invalid character (for example, -). <br /><br />Example #2: The specified value contains a double set of curly braces. <br /><br />Example #3: The specified value is missing a closing curly brace.<br /> | Example #1: %{resp_user-agent} <br /><br />Example #2: %{{host}} <br /><br />Example #3: %{host |
114-
| Missing variable name | A NULL value is always returned when a variable is not specified. | %{} |
115-
| Trailing characters | Characters that trail a variable are treated as literal values. <br />The sample value to the right contains a trailing curly brace that will be treated as a literal value. | %{host}} |
110+
| Missing variable name | A NULL value is always returned when a variable isn't specified. | %{} |
111+
| Trailing characters | Characters that trail a variable are treated as literal values. <br />The sample value to the right contains a trailing curly brace that gets treated as a literal value. | %{host}} |
116112

117113
## Setting default header values
118114
A default value can be assigned to a header when it meets any of the following conditions:
@@ -123,9 +119,9 @@ The following table describes how to define a default value.
123119

124120
| Condition | Syntax | Example | Description |
125121
| --------- | ------ | --------| ----------- |
126-
| Set a header to a default value when it meets any of the following conditions: <br /><br />- Missing Header <br /><br />- Header value is set to NULL.| %{Variable:=Value} | %{http_referrer:=unspecified} | The Referrer header will only be set to *unspecified* when it is either missing or set to NULL. No action will take place if it has been set. |
127-
| Set a header to a default value when it is missing. | %{Variable=Value} | %{http_referrer=unspecified} | The Referrer header will only be set to *unspecified* when it is missing. No action will take place if it has been set. |
128-
| Set the header to a default value when it does not meet any of the following conditions: <br /><br />- Missing<br /><br /> - Set to NULL. | %{Variable:+Value} | %{http_referrer:+unspecified} | The Referrer header will only be set to *unspecified* when a value has been assigned to it. No action will take place if it is either missing or set to NULL. |
122+
| Set a header to a default value when it meets any of the following conditions: <br /><br />- Missing Header <br /><br />- Header value is set to NULL.| %{Variable:=Value} | %{http_referrer:=unspecified} | The Referrer header is set to *unspecified* only when it's either missing or set to NULL. No action takes place if it has been set. |
123+
| Set a header to a default value when it's missing. | %{Variable=Value} | %{http_referrer=unspecified} | The Referrer header is set to *unspecified* only when it's missing. No action takes place if it has been set. |
124+
| Set the header to a default value when it doesn't meet any of the following conditions: <br /><br />- Missing<br /><br /> - Set to NULL. | %{Variable:+Value} | %{http_referrer:+unspecified} | The Referrer header is set to *unspecified* only when a value has been assigned to it. No action takes place if it's either missing or set to NULL. |
129125

130126
## Manipulating variables
131127
Variables can be manipulated in the following ways:
@@ -134,7 +130,7 @@ Variables can be manipulated in the following ways:
134130
- Removing patterns
135131

136132
### Substring expansion
137-
By default, a variable will expand to its full value. Use the following syntax to only expand a substring of the variable's value.
133+
By default, a variable expands to its full value. Use the following syntax to only expand a substring of the variable's value.
138134

139135
`%<Variable>:<Offset>:<Length>}`
140136

@@ -146,7 +142,7 @@ Key information:
146142
- Zero: The starting character of the substring is the first character in the string.
147143
- Negative: The starting character of the substring is calculated from the last character in the string.
148144

149-
- The length of the substring is determined by the *Length* term:
145+
- The length of the substring gets determined by the *Length* term:
150146

151147
- Omitted: Omitting the Length term allows the substring to include all characters between the starting character and the end of the string.
152148
- Positive: Determines the length of the substring from the starting character to the right.
@@ -162,7 +158,7 @@ The following string demonstrates various methods for manipulating variables:
162158

163159
https:\//www%{http_host:3}/mobile/%{request_uri:7:10}/%{request_uri:-5:-8}.htm
164160

165-
Based on the sample request URL, the above variable manipulation will produce the following value:
161+
Based on the sample request URL, the above variable manipulation produces the following value:
166162

167163
https:\//www.mydomain.com/mobile/marketing/proposal.htm
168164

@@ -214,7 +210,7 @@ Key information:
214210

215211
- Expand text that matches the specified pattern by specifying a dollar sign followed by a whole integer (for example, $1).
216212

217-
- Multiple patterns can be specified. The order in which the pattern is specified determines the integer that will be assigned to it. In the following example, the first pattern matches "www.," the second pattern matches the second-level domain, and the third pattern matches the top-level domain:
213+
- Multiple patterns can be specified. The order in which the pattern is specified determines the integer that is assigned to it. In the following example, the first pattern matches "www.," the second pattern matches the second-level domain, and the third pattern matches the top-level domain:
218214

219215
`%{host/=^www\.([^\.]+)\.([^\.:]+)/cdn.$2.$3:80}`
220216

@@ -238,8 +234,8 @@ Key information:
238234
- An operator must be specified before the pattern. The specified operator determines the pattern-capturing behavior:
239235

240236
- `=`: Indicates that all occurrences of the specified pattern must be captured and rewritten.
241-
- `^`: Indicates that only text that starts with the specified pattern will be captured.
242-
- `$`: Indicates that only text that ends with the specified pattern will be capture.
237+
- `^`: Indicates that only text that starts with the specified pattern is captured.
238+
- `$`: Indicates that only text that ends with the specified pattern is captured.
243239

244240
- If you omit the */Rewrite* value, the text that matches the pattern is deleted.
245241

0 commit comments

Comments
 (0)