Skip to content

Commit

Permalink
Merge pull request #145 from cloudops/docs/mc-14947-sp-edgerules
Browse files Browse the repository at this point in the history
Cleaning up
  • Loading branch information
sweetsweetstefan authored Mar 12, 2024
2 parents 1916eb9 + 2364572 commit c5fca7f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
Binary file removed assets/basic_deployment_in_4_minutes.jpg
Binary file not shown.
52 changes: 37 additions & 15 deletions en/stackpath-service/stackpath-sites-edgerules.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,46 @@ that inspect requests to see if they match certain conditions, and matching requ

Required permissions

Navigate to
Navigate to the StackPath service, click on *Sites*, and click on the desired site. When the *Overview* page appears, click on the *EdgeRules* item on the left.

### View EdgeRules

### Predeined EdgeRules
### Predefined EdgeRules

#### Force WWW connections
#### Custom robots.txt file
#### Pseudo-streaming
#### Referrer protection

StackPath provides four commonly used rules as predefined EdgeRules.

- **Force WWW connections:** redirect http://acme.com to http://www.acme.com. Be aware that this would redirect http://portal.acme.com to http://www.portal.acme.com.
- **Custom robots.txt file:** easily create and maintain a robots.txt file through the ui
- **Pseduo-streaming:** Allows a client to specify a seek point in a file.
- **Referrer protection:** Allows you to specify a set of domains from which users will be allowed to connect from, as identified by the `Referer` header. You can choose to allow empty referer headers. Requests not meeting these conditions will be blocked.

### Create a custom EdgeRule
### Custom EdgeRules

The predefined EdgeRules cover only a small set of cases. You can create custom EdgeRules to specifically target traffic that is of interest to you.

The interface will present a text field for the name. A condition type can be selected. Upon selecting a condition type, the interface will display the options appropriate for the condition type. Additionally, once a condition type is selected, the interface will display an action to select for the EdgeRule. Depending on the selected action, the interface will show the appropriate options for the action.

### EdgeRule conditions

Conditions may use five different attributes for an EdgeRule.
Conditions may inspect one of five different attributes for an EdgeRule.

- **URL:** The EdgeRule will to attempt to match a search pattern against the URL, which includes the protocol, hostname, path, and query parameters. When defining the pattern, you may use:
- A **simple string** for a direct match. If the exact string is found in the URL, the pattern will match. The asterisk (*) may be used as a wildcard to match zero or more characters.
- A **regular expression**. The pattern should be enclosed within a pair of forward slashes (/). If the regular expression finds at least one match, the condition will be triggered.
- **Header:** Looks at entire header line.
- A **simple string** for a direct match. If the exact string is found in the header line, the pattern will match. The asterisk (*) may be used as a wildcard to match zero or more characters.
- A **regular expression**. The pattern should be enclosed within a pair of forward slashes (/). If the regular expression finds at least one match, the condition will be triggered.
- **HTTP method:** Match against the request method. Select one or more methods from the popup menu.
- **Status code:** Comma-separated list of HTTP status codes.
- **Cookie:** Looks at cookie name and value.
- A **simple string** for a direct match. If the exact string is found in the cookie, the pattern will match. The asterisk (*) may be used as a wildcard to match zero or more characters.
- A **regular expression**. The pattern should be enclosed within a pair of forward slashes (/). If the regular expression finds at least one match, the condition will be triggered.

- **URL:**
- **Header:**
- **HTTP method:**
- **Status code:**
- **Cookie:**

### EdgeRule actions

Expand All @@ -55,24 +66,28 @@ An EdgeRule may specify one of four general types of actions to execute when the

1. Add response header
- Added to response from CDN to end user
- Put the header name into the Key field.
- Enter the header name into the **Key** field.
- Enter the desired value in to the **Value** field
1. Add header to CDN
- Add to request from user to CDN
- Put the header name into the Key field
- Enter the header name into the **Key** field.
- Enter the desired value in to the **Value** field
1. Add header to origin
- Add to request from CDN to origin server
- Put the header name into the Key field
- Enter the header name into the **Key** field.
- Enter the desired value in to the **Value** field
1. Modify header
- Modify value of existing header <- Where? In the request?
1. Remove header
1. Hide header
- From where? The request?
- Seems like you can use this to replace the value in the header.
- Enter the name of the header to hide in the **Header** field

#### Caching rules

1. Cache
1. Cache -- specify a TTL
1. Do not cache
1. Never expire
1. Bypass cache -- How is this different from Do not cache? The only example in the SP// docs I can find is https://stackpath.dev/docs/bypass-cache-on-url, which uses Do not cache lol

#### Redirect rules

Expand All @@ -84,6 +99,13 @@ Not clear what happens here?

URL Signing policies allow you to restrict access to your content by configuring a "shared secret" with StackPath. This "shared secret" is used to apply an MD5 hashing algorithm on the URL to validate the signature supplied on the request. Since the "shared secret" is only known by the publisher and StackPath, URL signatures cannot be generated by unauthorized users.

- Passphrase
- Passphrase field
- MD5 token field
- TTL field
- IP address filter
- URL signature path length (optional)

### List of general variables

| Variable name | Description |
Expand Down

0 comments on commit c5fca7f

Please sign in to comment.