From 331b5e276dcb2bb8200ea7252e41ccee8cf2cce1 Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:03:28 +0100 Subject: [PATCH] feat: cloudflare cache guide --- deployment/cloudflare-cache-rules.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 deployment/cloudflare-cache-rules.md diff --git a/deployment/cloudflare-cache-rules.md b/deployment/cloudflare-cache-rules.md new file mode 100644 index 0000000..761fd62 --- /dev/null +++ b/deployment/cloudflare-cache-rules.md @@ -0,0 +1,20 @@ +# Cloudflare Configuration + +To optimize performance, configure Cloudflare to offload traffic from your server. We use **Cache Rules** to cache public stream results while respecting the application's cache headers. + +## 1. Public Streams (Cache Rule) +Allow Cloudflare to cache public stream results. Comet automatically controls the duration (TTL) and freshness (Stale-While-Revalidate) via headers. + +* **Rule Name**: Public Streams +* **Expression**: `(starts_with(http.request.uri.path, "/stream/"))` +* **Action**: Eligible for Cache +* **Edge TTL**: Use cache-control header if present +* **Browser TTL**: Respect origin +* **Serve stale content while revalidating**: On + +## 2. Tiered Cache +Enable **Tiered Cache** in **Caching > Tiered Cache**. +This minimizes requests to your origin by checking other Cloudflare datacenters first. + +--- +*Note: Private streams (URLs containing your configuration) are automatically excluded because they do not start with `/stream/`.*