Upload rule in CSV format
Instead of using the GUI to add rules, follow this procedure to add rules using CSV upload.
How to
-
Review the CSV file that contains the rules, and verify that the information is accurate and conforms to the required format.
-
Go to ☰ > CDN > Edge logic Cloudlets.
-
On the Cloudlet Policies screen, click the name of the policy you want to add rules to.
-
On the Policy Details screen, click the version of the policy you want to update.
-
On the rule manager screen, click Upload Rules.
-
Review the following explaining the purpose of the Overwrite existing? check box.
Overwriting RulesWhen you upload rules and check Overwrite existing?, rules currently in the Rule List are overwritten (refer to the following figure).
If Overwrite existing? is unchecked (disabled), the rules in the Rule List are not overwritten and the rules in the CSV file are added to the list. You will receive warnings if there are duplicated rules.
Check (enable) Overwrite existing? if the rules in the Rule List are not required or if they are required but included in your CSV file.
- Drop or browse files to Upload the CSV file.
- Once the upload is successful, verify that the rules are in your desired order.
Upload validation rules
These validation rules apply when you upload Cloudlets rules with a CSV file:
-
The first row is a header row and is always ignored.
-
In the
matchURLandredirectURLcolumns, you can use quotation marks to preserve commas. -
Rules added using CSV upload are added to end of the current list of rules.
Rule syntax
When you upload Cloudlets rules using a CSV file, you use a special syntax. This syntax is also in the CSV rule you receive when you download rules.
Valid delimiter
When entering multiple values for a data type, use a space as a delimiter.
Literal usage of spaces
If you want to use a space in your CSV file, you need to type a backslash (\) first. For example, to upload a rule named "Q1 Sales Site", you would enter it this way: Q1\ Sales\ Site.
Basic CSV file syntax
| Category | Usage | Examples |
|---|---|---|
| Pattern Matching | ||
| CasCase Sensitivity | : Note: Applies to match type values, not the whole rule. | ruleName, matchURL, query, result.redirectURL, result.statusCode rule 1, https://example.com, :product=ER VP, https://cloudlets.com, 302 |
| Wildcards | * or ? | ruleName, matchURL, query,result.redirectURL, result.statusCode rule 1, https://example.com, product=E* FR, https://cloudlets.com, 302 |
| Operators | ||
| Is one of (equals) | <value1> <value2>... | ruleName, matchURL, query,result.redirectURL, result.statusCode rule 1, http://example.com, product=ER FR, http://example2.com, 302 |
| Is not one of (does not equal) |
Note: Applies to match type values, not the whole rule. | ruleName, matchURL, query,result.redirectURL, result.statusCode rule 1, http://example.com, !product=ER FR, http://example2.com, 302 |
| Contains any of |
Note: Applies to match type values, not the whole rule. | ruleName, matchURL, query,result.redirectURL, result.statusCode rule 1, http://example.com, product=*ER* *FR*, http://example2.com, 302 |
| Does not Contain any of |
Note: Applies to match type values, not the whole rule. | ruleName, matchURL, query,result.redirectURL, result.statusCode rule 1, http://example.com, !product=*ER* *FR*, http://example2.com, 302 |
| And |
Important: Only applies to these match types: |
Fields for rule uploads and downloads
The following are the fields available when setting up the syntax for CSV-based rules or downloading rules.
| Data Type | CSV Column Name | Action/Description |
|---|---|---|
| Required Fields | ||
| Rule name | ruleName | Enter a descriptive name for the rule. This field is required for all rules. |
| HTTP status code | result.statusCode | For Edge Redirector, enter the status code for the type of redirect this rule supports. Options include:
|
| Source URL | matchURL | For Edge Redirector, enter the name of the source, or inbound, URL. Enter the full web address that you are redirecting, including the protocol. For example: |
| Redirect URL | result.redirectURL | For Edge Redirector, enter the HTTP- or HTTPS-based URL to redirect to if the rule is true. Enter the full web address you are redirecting the source URL to, including the protocol. For example: Option: If you want the protocol and hostname from the incoming request to be used in the Redirect URL, add a column to your .csv called; Option: If you want to use a relative URL and have the client or browser receiving the request decide which protocol and hostname to use, add a column to your .csv called; |
| Optional Fields | ||
| Continent Code (Part of User Data Location Match) | continentCode | If applicable, enter the appropriate continent code in uppercase letters to match based on continent. For this match type, you can also select whether to use the client IP address from the connecting IP address For example, enter this to select one continent and both client IP options: Note the spaces used between multiple values and the semicolon separating the data types. |
| Cookie | cookie | Enter a cookie to match on using the following format: For example: You can use the |
| Country Code (Part of User Data Location Match) | countryCode | If applicable, enter the appropriate country code in uppercase letters to match based on country. For this match type, you can also select whether to use the client IP address from the connecting IP address For example, enter this to select one country and both client IP options: Note the spaces used between multiple values and the semicolon separating the data types. |
| Default | matchAlways | Enter This match type is particularly useful at the end of a rule list. If none of the other rules in the list produce a match, then you can use the default match type to treat the remaining traffic in a particular way. |
| Device Characteristics | deviceCharacteristics | Enter one of these device characteristics to match on: accept_third_party_cookieajax_support_javascriptcookie_supportfull_flash_supportis_mobileis_tabletis_wireless_deviceWhen creating a true match, enter only the name of the device characteristic.To create a false match, add an exclamation point in front of the device characteristic’s name. For example: |
| End Time | utcEndTime | Using the UTC format, enter the end date and time for the rule in seconds. Enter If you enter a value in this field other than “0”, you must enter a value greater than “0” in the |
| File Extension | extension | Enter the file extension(s) to match on. You do not need to enter the period before the extension. For example: Note: When entering multiple values, separate them with a space. |
| Hostname | hostname | Enter the hostname to match on. Include the domain but exclude the protocol. For example: www.example.com. You can use the * wildcard with this match type. |
| IP address or CIDR List | clientip | Enter an IP address or CIDR list to match on. For example: When entering multiple values, separate them with a space. You are limited to 8192 characters. For this match type, you can also select whether to use the client IP address from the connecting IP address For example, enter this to select one IP address and both client IP options: Note the spaces between multiple values and the semicolon separating the data types. |
| Pass Query Parameters | result.useIncomingQueryString | Enter either 0 (false) or 1 (true) to append all query parameters from the source URL to the redirect URL. |
| Protocol | protocol | Enter either HTTP or HTTPS as the protocol to match on. You can enter the protocol using either uppercase or lowercase letters. |
| Proxy | proxy | Enter the type of proxy to match on. Values include While anonymous proxy servers hide the originating IP address, transparent proxy servers include the originating IP address in the X-Forwarded-For (XFF) value in the HTTP header. For this match type, you can also select whether to use the client IP address from the connecting IP address For example, enter this to select both options for proxy and client Note the spaces between the values and the semicolon between the data types. |
| Query String Parameter Match | query | Enter the query string to match on using the following format: For example: Note: You can use the |
| Region Code (Part of User Data Location Match) | regionCode | If applicable, enter the appropriate region code in uppercase letters. Region code matches are based on a region, like a state or a province, within a country. For this match type, you can also select whether to use the client IP address from the connecting IP address For example, enter this to select one region/state and both client IP options: Note the spaces between the values and the semicolon between the data types. |
| Regular Expression Match | regex | Enter a single URL-based regular expression (regex) to match on. A single CVS rule cannot contain multiple regex values. For example: Note: When using a regular expression match with Edge Redirector, the Redirect URL (result.redirectURL) can include capture groups. For example: Path and Query String (result.pathAndQS) can include capture groups. |
| Request Header | header | Enter the request header to match on using the following format: For example: Accept: Note: Separate the request header type and value with a colon (:), not an equals sign. Note: You can use the |
| Request Method | method | Enter the request header to match on. Options include the following: DELETE, GET, HEAD, POST, and PUT. |
| Start Time | utcStartTime | Using the UTC format, enter the starting date and time for the rule in seconds. Enter If you enter a value in this field other than “0”, you must enter a value greater than “0” in the |
| URL Path | path | Enter the URL path to match on. Include the leading slash but omit any training slashes. For example: Note: You can use the |
Character considerations for rule upload
Special character support
You can use these characters for inbound/source URL matches:
| \ ^ [ ] `
Invalid characters
Do not use the following characters in the CSV file you create for rule upload. They are invalid:
| < | > | @ | “ | \ | ¡ |
| ¢ | £ | ¤ | ¥ | ¦ | § |
| ¨ | © | ª | « | ¬ | ' |
| ® | − | ° | ± | ² | ³ |
| ´ | µ | ¶ | · | ¸ | ¹ |
| ¹ | º | » | ¼ | ½ | ¾ |
| ¿ | À | Á | Â | Ã | Ä |
| Å | Æ | Ç | È | É | Ê |
| Ë | Ì | Í | Î | Ï | Ð |
| Ñ | Ò | Ó | Ô | Õ | Ö |
| × | Ø | Ù | Ú | Û | Ü |
| Ý | Þ | ß | à | á | â |
| ã | ä | å | æ | ç | è |
| é | ê | ë | ì | í | î |
| ï | ð | ñ | ò | ó | ô |
| õ | ö | ÷ | ø | ù | ú |
| û | ü | ý | þ | ÿ |
In addition, Unicode Private Use Area (PUA) characters are also invalid.
Characters with special uses
When setting up your CSV file for rule upload, the following characters have special uses:
| Character | Use |
|---|---|
| " | Encapsulates strings in field values. |
| # | Denotes a comment when used at the start of a line, or when preceded by a space anywhere in a line. All other instances of this character is treated as a literal. Valid Usage Here is an example of a CSV file with valid comments: Invalid Usage
|
CSV rule file examples
Edge Redirector CSV example
Here's an example of a CSV file for uploading Edge Redirector Cloudlet rules:
Request Header match example
Here is an example of a CSV file that includes rules using the Request Header match type:
This table summarizes the syntax demonstrated in each of these rules:
| Rule Type | Syntax Demonstrated |
|---|---|
| Browser version rule | Escaped spaces (\), wildcards (*), and multiple values (space separated values) |
| API Request | contentType=… |
| TextRequest | contentType:… (use of colon and escaped space) |
contentType exists | matchOperator=”exists” (CSV: ?) Request header name-only, no colon/equals, and no value |
No contentType exists | Negation (CSV: ‘!’) of header contentType existence |
Updated 18 days ago
