feat: improve cloudflare guide

This commit is contained in:
g0ldyy
2026-01-09 23:41:56 +01:00
parent 1841dceaf3
commit 8b8b76324b
+27 -13
View File
@@ -1,27 +1,41 @@
# Cloudflare Configuration
To optimize performance, configure Cloudflare to offload traffic from your server. We use **Cache Rules** to cache stream results while respecting the application's cache headers.
To optimize performance, configure Cloudflare to offload traffic from your server. We use **Cache Rules** to cache responses while respecting the application's cache headers.
## 1. Public Streams (Cache Rule)
Cache public stream results. Comet controls the TTL via headers.
## 1. Streams (Cache Rule)
Cache all stream results (public and private). Comet controls the TTL via headers.
* **Rule Name**: Public Streams
* **Expression**: `(starts_with(http.request.uri.path, "/stream/"))`
* **Rule Name**: Streams
* **Expression**: `(http.request.uri.path contains "/stream/")`
* **Action**: Eligible for Cache
* **Edge TTL**: Use cache-control header if present
* **Edge TTL**: Use cache-control header if present (first option)
* **Browser TTL**: Respect origin
* **Serve stale content while revalidating**: On
## 2. Private Streams (Cache Rule)
Cache private stream results (with user config in URL). The config is part of the URL, so each user+media combination has a unique cache key. This prevents the same user from hitting the origin repeatedly for the same content.
## 2. Configure Page (Cache Rule)
Cache the configuration page.
* **Rule Name**: Private Streams
* **Expression**: `(http.request.uri.path contains "/stream/" and not starts_with(http.request.uri.path, "/stream/"))`
* **Rule Name**: Configure Page
* **Expression**: `(http.request.uri.path eq "/configure")`
* **Action**: Eligible for Cache
* **Edge TTL**: Use cache-control header if present
* **Edge TTL**: Use cache-control header if present (first option)
* **Browser TTL**: Respect origin
* **Serve stale content while revalidating**: On
## 3. Tiered Cache
## 3. Manifest (Cache Rule)
Cache manifest.json responses.
* **Rule Name**: Manifest
* **Expression**: `(ends_with(http.request.uri.path, "/manifest.json"))`
* **Action**: Eligible for Cache
* **Edge TTL**: Use cache-control header if present (first option)
* **Browser TTL**: Respect origin
## 4. Tiered Cache
Enable **Tiered Cache** in **Caching > Tiered Cache**.
This minimizes requests to your origin by checking other Cloudflare datacenters first.
## 5. Network Optimizations
In **Speed > Protocol**:
* **HTTP/3 (QUIC)**: On (faster connections, especially on mobile)
* **0-RTT Connection Resumption**: On (reduces latency for repeat visitors)