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
Copy file name to clipboardExpand all lines: articles/application-gateway/rewrite-http-headers-url.md
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,25 +62,23 @@ A rewrite set is a collection of a Routing Rule, Condition and Action.
62
62
1. URL Query String: The new value to which the query string must be rewritten to.
63
63
1. Re-evaluate path map: Specify if the URL path map must be re-evaluated after rewrite. If kept unchecked, the original URL path will be used to match the path-pattern in the URL path map. If set to true, the URL path map will be re-evaluated to check the match with the rewritten path. Enabling this switch helps in routing the request to a different backend pool post rewrite.
64
64
65
-
DONE
66
-
67
65
## Pattern matching and Capturing
68
-
Patten matching and capturing are supported under Condition and Action. Pattern matching and capturing under Actionis supported only for a specific header.
66
+
Patten matching and capturing are supported under Condition and Action (under Action, it is supported only for a specific header).
69
67
70
68
### Pattern matching
71
69
Application Gateway uses regular expressions for pattern matching. You should use Regular Expression 2 (RE2) compatible expressions when writing your pattern matching syntax.
72
70
73
71
You can use pattern matching under both Condition and Action.
74
72
1.**Condition**: This is used to match the values for a Header or Server Variable. To match a pattern under "Conditions" use the "pattern" property.
75
-
1.**Action**: Pattern matching under Action Set is only available for Response header "Set-Cookie". To match a pattern for Set-Cookie under an action, use the "HeaderValueMatcher" property. If captured, its value can be used as {capt_header_value_matcher}. As there can be multiple Set-Cookie, a pattern matching here allows you to look for other additional conditions. Example: For certain versions of user-agent under Condition, rewrite the set-cookie named "cookie2" with max-age=3600 (one hour).
73
+
1.**Action**: Pattern matching under Action Set is only available for Response header "Set-Cookie". To match a pattern for Set-Cookie under an action, use the "HeaderValueMatcher" property. If captured, its value can be used as {capt_header_value_matcher}. As there can be multiple Set-Cookie, a pattern matching here allows you to look for a specific cookie. Example: For a certain version of user-agent, you want to rewrite the set-cookie named "cookie2" with max-age=3600 (one hour). In this case, you can use
> If you are running an Application Gateway Web Application Firewall (WAF) with Core Rule Set 3.1 or earlier, you may run into issues when using Perl Compatible Regular Expressions (PCRE) while doing lookahead and lookbehind (negative or positive) assertions.
79
79
80
80
### Syntax for capturing
81
81
82
-
To capture a substring for later use, put parentheses around the subpattern that matches it in the condition regex definition. The first pair of parentheses stores its substring in 1, the second pair in 2, and so on. You may use as many parentheses as you like; Perl just keeps defining more numbered variables for you to represent these captured strings. Some examples from [ref]:
83
-
84
82
Patterns can also be used to capture a sub-string for later use. Put parentheses around a sub-pattern in the regex definition. The first pair of parentheses stores its substring in 1, the second pair in 2, and so on. You may use as many parentheses as you like; Perl just keeps defining more numbered variables for you to represent these captured strings. You can find some example in this [Perl programming guidance](https://docstore.mik.ua/orelly/perl/prog3/ch05_07.htm).
85
83
* (\d)(\d) # Match two digits, capturing them into groups 1 and 2
86
84
* (\d+) # Match one or more digits, capturing them all into group 1
0 commit comments