If you are having problems using conditions, here are some common mistakes to look for:
- Don't put the
if ()statement in the Apply If field of the condition window. The actual if statement is implied. You only need to type an evaluated expression. For example:
req.url ~ "^/special/".
- Don't use the
!~(inverse regex match) to build regular expressions that exclude particular URLs. For example, if you want to apply something to all URLs except those that start with
/admin, the condition for this is
req.url !~ "^/admin"and is entered in the Apply If field. An alternative to this expression would be
!(req.url !~ "^/admin").
The Conditions Overview on the Configuration Controls provides an summary of how conditions are used and mapped in your service. In order to edit those conditions, however, you need to access the location where those conditions are applied.
For example, if you had a condition that was being applied to a header, you wouldn't edit it via the Conditions Overview, you would edit that condition in your service's configuration as follows:
- Click the Content pane on the left side and click the gear box to the right of the name of the appropriate header.
- Select Conditions from the menu that appears.
- Click Edit from the Choose Condition window that appears and begin editing the selected condition.
The following links provide additional information useful when working with and troubleshooting conditions:
- Fastly Help Guides provides basic editing information when using the application.
- Tizag Perl tutorial explains basic C-style logical expression syntax (e.g., basic logic, operators such as &&, precedence) that users need to be familiar with when creating conditions.
- Varnish-Cache.org documentation explains different set of VCL variables that a condition can use to determine if an object applies.
- Varnish Cache documentation on variables describes variables that are used use to craft conditions.