# Cloudflare Cache Rules — DIR//LISTER # Dashboard: Caching → Cache Rules (or Rules → Cache Rules) # Also enable: Caching → Configuration → "Browser Cache TTL: Respect Existing Headers" # And: Cache → Configuration → Origin Cache Control (respect origin) = ON # --------------------------------------------------------------------------- # Rule 1 — Bypass dynamic app (highest priority) # Name: dirlister-bypass-dynamic # When incoming requests match: # (http.request.uri.path eq "/index.php") # or (http.request.uri.path eq "/") # or (http.request.uri.query contains "api=") # or (http.request.uri.query contains "login") # or (http.request.uri.query contains "selftest") # Then: # Cache eligibility = Bypass cache # Origin Cache Control = Respect origin # # --------------------------------------------------------------------------- # Rule 2 — Cache versioned static assets # Name: dirlister-cache-static # When: # (http.request.uri.path.extension in {"css" "js"}) # Then: # Cache eligibility = Eligible for cache # Edge TTL = Ignore cache-control header and use this TTL → 7 days # (or "Use cache-control header if present, bypass cache if not") # Browser TTL = Override origin → Respect origin # Origin Cache Control = Respect origin # # --------------------------------------------------------------------------- # Rule 3 — Cache images / fonts # Name: dirlister-cache-media # When: # (http.request.uri.path.extension in {"webp" "png" "jpg" "jpeg" "gif" "svg" "ico" "woff" "woff2"}) # Then: # Eligible for cache # Edge TTL = 30 days # Browser TTL = Respect origin # # --------------------------------------------------------------------------- # Purge after deploy: # Dashboard → Caching → Configuration → Purge Cache # - Purge by URL: https://your.domain/index.css https://your.domain/index.js # - Or Purge by tag (Enterprise): dirlister-static , dirlister-html # # Do NOT enable "Cache Everything" page rule on /* for this app. # Do NOT enable APO (WordPress only).