Review available match types for Forward Rewrite
Available match types
Before you start setting up your Forward Rewrite rules, review the match types available with this Cloudlet:
Match Type | Matches Based on... | Wildcard Support | Case Sensitivity Support | Multiple Value Support |
---|---|---|---|---|
Cookie | a combination of cookie name and cookie value. | ✓ | ✓ | ✓ |
Device Characteristics | a list of available device characteristics. | |||
File Extension | the file extensions to match on. | ✓ | ✓ | ✓ |
Hostname | the hostnames to match on. | ✓ | ||
IP address/CIDR list | an IP address or CIDR list. You can also select whether to use the client IP address from the connecting IP address, the X-Forwarded-For HTTP header value, or either option. | ✓ | ||
Protocol | the protocol to match on. HTTP or HTTPS protocol are the current options, and you can only select one protocol per match. | |||
Proxy | whether the edge platform has determined that the incoming IP address is acting as a proxy. | |||
Query String | the query string values to match on. For example, name or name=value1 or name=value1 value2 . | ✓ | ✓ | ✓ |
Request Header | a request header value. | ✓ | ✓ | |
Request Method | the method used for the request, like GET or POST . | |||
URL Path | the URL paths to match on. For example: /clothing/children/shoes/shoe1.jpg | ✓ | ✓ | ✓ |
URL Regular Expression | a regular expression. For more information see the Forward Rewrite regular expression example. | |||
User Location Data | a combination of the following geographic categories: continent, country, and region/state. | ✓ |
Forward Rewrite regular expression example
Here's how you can set up a regex rule for forwarding both HTTP and HTTPS traffic from the same inbound URL to a different outbound URL:
In this case, the Regular Expression value is (?:http|https)://(?:[A-z0-9|\.]*)/(.*)
and the Path and Query String value, with substitution pattern, is /\1&extra_param=bar
.
For Forward Rewrite, you can only use substitution patterns on the URL path. If you want to change the protocol or host, you need to use Conditional Origins.
When this rule is activated, all requests to http://www.example.com/path1/path2/home.html?query=foo
would retrieve content from http://www.neworigin.com/path1/path2/home.html?query=foo&extra_param=bar
without changing the URL.
If your regular expression includes any characters that have a special use in regular expressions (like ".", "+", or "?"), you must use a backslash ( \ ) to escape each special character.
Updated almost 2 years ago