URL regular expression
Description
Match on the fully qualified incoming request URL using regular expressions (regex). Regex uses a sequence of characters to define a search pattern. Regular expressions for Cloudlets use the RE2 library.
Depending on the Cloudlet, you can also use the information from capture groups in regex to form either the redirect URL, or the forward path/query string.
For example, if you are using regex with the Edge Redirector Cloudlet, you might use the following values:
- Regex:
(http|https)://www.(vanity|vanity1).com/(.*)
- Redirect URL:
\1://www.company.com/\2/\3
- Test URL:
https://www.vanity.com/item?name=value
- Result:
https://www.company.com/vanity/item?name=value
Cloudlets Supported
The following Cloudlets support this match type:
- Audience Segmentation
- Edge Redirector
- Forward Rewrite
Fields
For this match type, you complete the following fields:
Name | Description | Example |
---|---|---|
Regular Expression (Regex) | Enter a regex of up to 256 characters to match on the inbound URL, minus the port. | (http|https)://www.(vanity|vanity1).com/(.*) |
Redirect URL (Edge Redirector Only) | For Edge Redirector, enter either: You must verify that the output URL is correct. | \1://www.company.com/\2/\3 |
Path and Query String (Forward Rewrite Only) | For Forward Rewrite, enter either: You must verify that the output URL is correct. | /\1/\2 |
Operators
This match type does not include operators.
For more information about regex for Cloudlets, see Regular expressions with Cloudlets rules.
Updated over 1 year ago