Last active
June 19, 2026 09:35
-
-
Save jessuppi/4a8334d777621867f08c24f77c0857fc to your computer and use it in GitHub Desktop.
Cloudflare "Cache Everything" Rule For WordPress Websites
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| If incoming requests match... | |
| > Custom filter expression | |
| When incoming requests match... | |
| > Edit expression | |
| ( | |
| http.request.method in {"GET" "HEAD"} | |
| and not http.request.uri.path wildcard "/cdn-cgi/*" | |
| and not http.request.uri.path wildcard "/wp-admin*" | |
| and not http.request.uri.path wildcard "/wp-login.php*" | |
| and not http.request.uri.path wildcard "/wp-json*" | |
| and not http.request.uri.query contains "preview" | |
| and not http.request.uri.query contains "wp_customize" | |
| and not http.request.uri.query contains "customize_changeset_uuid" | |
| and not http.cookie contains "wordpress_logged_in_" | |
| and not http.cookie contains "wordpress_sec_" | |
| and not http.cookie contains "wp-postpass_" | |
| and not http.cookie contains "comment_author_" | |
| ) | |
| Then... | |
| Cache eligibility | |
| > Eligible for cache | |
| Edge TTL | |
| > Ignore cache-control header and use this TTL | |
| Input time-to-live (TTL) | |
| > 2 hours | |
| Status code TTL | |
| > Greater than or equal - 500 - No store | |
| Browser TTL | |
| > Bypass cache | |
| Cache key | |
| > None | |
| Cache deception armor | |
| > Enabled | |
| Sort query string | |
| > Enabled | |
| Serve stale content while revalidating | |
| > Do not serve stale content while updating (disabled) | |
| Respect strong ETags | |
| > Use strong ETag headers (disabled) | |
| Origin error page pass-through | |
| > Use Origin error page pass-thru (disabled) | |
| Place at | |
| Select order | |
| > First |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's another rule for caching WordPress assets:
https://gist.github.com/jessuppi/a311546d5334254bc50245b12d1b90c3