This article is a basic example of a Conditional EdgeRule, aimed at helping you understand the core functionality of using Conditionals with your rules.
The EdgeRules feature is available only on Enterprise plans.
Example: Defining Caching Behavior for Specific File Types
This rule prevents caching if the file extension ends with .css
or .js
and the http method
is either GET
or HEAD
. Notice that we have to use variables to accomplish this behavior.
Example of the Rule
Regular Expression Visualization
Resulting Nginx Configuration Block
location ~ \.(?:css|js)$ {
set $no_cache 0
if ($http_method ~ (GET|HEAD)) {
set $no_cache 1;
}
...
proxy_no_cache $no_cache;
...
}
We hope this article was helpful and as always, If you have any questions or concerns about any of the topics mentioned in this article, please feel free to reach out to support - we are available 24/7 by chat or email!