Introducing Edgio Applications v7Find out what's new.
Edgio
Edgio

Request Matching Scenarios

Before adding features that customize how your traffic is processed, you must first decide the set of requests to which they will be applied. You may either apply them to all requests or use match condition(s) to only apply them to specific requests. Common request matching scenarios are listed below.
In addition to these common scenarios, there are many other ways through which Rules can match requests. Additionally, you can combine match conditions to selectively apply features when multiple conditions have been met. You may also use Else or Else If statements to apply features when specific criteria has not been met. The power and flexiblity of Rules allows you to use basic configurations or build upon them to create a configuration that addresses your complex business needs.

All Requests

Create a rule without match conditions to apply a set of features to all requests. The recommended position for this rule is the top of the list. This allows rules positioned below it to override this configuration for specific use cases.
Check for the always applied label to verify that a rule does not have match conditions.
Rule that applies to all requests.

Request URL

Apply a set of features to:
  • A specific hostname through the Request Header match condition.
  • A specific path through the Path match condition.
  • A query parameter through the Query Parameter match condition.

Hostname

Use the Request Header match condition to find requests by hostname.
  1. Set the Header Name option to Host.
  2. Verify that the Operator option is set to equals.
  3. Set the Value option to the desired hostname.
The following configuration matches all requests whose Host header is set to cdn.example.com.
Request Header match condition
Match all requests for multiple hostnames through a regular expression. The following configuration matches all requests whose Host header is set to cdn.example.com, www.example.com, or images.example.com.
Multiple hostnames - Request Header match condition

Path

Use the Path match condition to match requests by path. The most common configuration is to apply a rule across all requests whose relative URL starts with a specific value. Set up this match condition by selecting the matches regular expression operator and then appending .* to the desired relative path.
Path match condition
The above match configuration matches all requests whose relative path starts with: /marketing/conferences/. For example, it matches all of the following request URLs:
1https://cdn.example.com/marketing/conferences/widgets/index.html
2https://cdn-2.example.com/marketing/conferences/widgets/resources/stylesheets/styles.css`
3https://images.example.com/marketing/conferences/widgets/features.png
Restrict the above rule to images whose relative path starts with: /marketing/conferences/ by adding the Extension match condition. Set up this match condition by selecting the is one of operator and then defining the desired file extensions (e.g., png, jpg, and jpeg).
Path match condition
The Rewrite URL match condition is incompatible with the Extension match condition. Use the Path match condition instead.
View a sample configuration.

Query String

Use the Query Parameter match condition to find requests that contain a query string parameter set to a specific value. The following configuration matches all requests whose query string contain session=active.
Query Parameter match condition
For example, the above configuration matches against the following request:
https://cdn.example.com/marketing/experience.png?session-id=12345&session=active&width=300

HTTP Method

Use the Method match condition to find requests submitted with the desired HTTP method (e.g., POST, PUT, or GET).
Method match condition

Cookies

Use the Cookie match condition to find requests that contain a cookie set to a specific value. The following configuration matches all requests that contain this cookie: type=oatmeal.
Cookie match condition
For example, the above configuration matches against a request that contains the following cookies:
sessionid=12345; type=oatmeal; token=1fj4f3nfy4f7s

Headers

Use the Request Header match condition to find requests that contain a header set to a specific value. The following configuration matches all requests whose Accept-Language header contains en-US.
Request Header match condition

Country

Use the Country match condition to find requests from one or more countries. The following configuration matches all requests from the US, Canada, and Mexico.
Country match condition
View additional geolocation match conditions.

Matching with Conditional Logic

Match requests when they satisfy:

Multiple Match Conditions

You can add multiple match conditions to a single statement. By default, a request must satisfy all of these conditions before a set of features will be applied to it.
The following sample configuration redirects traffic that meets both of the following conditions:
  • Matches a specific relative path.
  • Originates outside of North America.
Multiple match conditions
The and label, which appears next to the Country match condition, indicates that a request must satisfy both match conditions before it will be redirected.

Any Match Condition in a Statement

Apply a set of features to requests that match any match condition in a statement by toggling the and labels to or labels.
The following sample configuration redirects traffic when it meets any of the following conditions:
  • The request’s relative path starts with: /shopping/
  • The request originated from a country other than the United States, Mexico, or Canada.
  • The request contained a session cookie set to active.
Any match conditions

Any Statement

Add at least one match condition to an Else statement to allow requests to match against any of a rule’s statements.
In the following sample rule, Edgio will first check whether the request’s relative path starts with /shopping/. If the request starts with a different relative path, it will then check whether the request originated from the United States, Canada, or Mexico. If the request starts with a different relative path and does not originate from those countries, then it will check whether the session cookie has been set to set active.
Any statement

Fallback Matching

Add an Else statement without any match conditions to match requests that do not satisfy any of the preceding statements.
In the following sample rule, a default caching policy is applied to requests when their relative path does not start with /shopping/ or if they were not issued from the United States, Canada, or Mexico.
Else statement