diff --git a/src/content/docs/cache/how-to/cache-rules/examples/cache-by-hostname-list.mdx b/src/content/docs/cache/how-to/cache-rules/examples/cache-by-hostname-list.mdx new file mode 100644 index 000000000000000..f1090e74e4f2f6b --- /dev/null +++ b/src/content/docs/cache/how-to/cache-rules/examples/cache-by-hostname-list.mdx @@ -0,0 +1,29 @@ +--- +pcx_content_type: example +summary: Cache everything for hostnames in a list +title: Cache everything for hostnames in a list +description: Cache everything for hostnames in a list +products: [cache-rules] +--- + +import { Example } from "~/components" + +[Create a cache rule](/cache/how-to/cache-rules/create-dashboard/) to cache everything for hostnames that match a [custom hostname list](/waf/tools/lists/custom-lists/#lists-with-hostnames): + + + +- **When incoming requests match**: Custom filter expression + - Using the Expression Builder:
+ `Hostname is in list "my_hostnames"` + - Using the Expression Editor:
+ `(http.host in $my_hostnames)` + +- **Then**: + - **Cache eligibility**: Eligible for cache + +
+ +:::note + +The **is in list** operator requires an Enterprise plan. You must first [create a hostname list](/waf/tools/lists/create-dashboard/) in your account before you can reference it in a cache rule expression. +::: diff --git a/src/content/docs/cache/how-to/cache-rules/settings.mdx b/src/content/docs/cache/how-to/cache-rules/settings.mdx index 325e0259940cbfd..3a800d2ec63a51b 100644 --- a/src/content/docs/cache/how-to/cache-rules/settings.mdx +++ b/src/content/docs/cache/how-to/cache-rules/settings.mdx @@ -59,12 +59,19 @@ The operators available for Cache Rule expressions are: - does not end with - is in - is not in +- is in list +- is not in list :::note Not all operators are available for every selected field. ::: +:::note + +The **is in list** and **is not in list** operators are available for the Hostname field on Enterprise plans. They allow you to match requests against [custom lists](/waf/tools/lists/custom-lists/) — for example, a hostname list containing all the domains you want to apply a particular caching configuration to. Refer to [Use lists in expressions](/waf/tools/lists/use-in-expressions/) for details on using lists in rule expressions. +::: + ## Cache eligibility In **Cache eligibility**, you have the option to select **Bypass cache** if you want matching requests to not be cached, or **Eligible for cache** if you want Cloudflare to attempt to cache them.