-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[Support Feedback] Add TTFB, caching, load balancing, and Argo troubleshooting (Speed/Cache) #28998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dmmulroy
wants to merge
4
commits into
cloudflare:production
Choose a base branch
from
dmmulroy:support-macros/speed-cache
base: production
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
055a0a3
docs: add speed, cache, load balancing, and Argo troubleshooting from…
dmmulroy 6f08df8
fix: correct usage-based billing notifications link path
dmmulroy fc43e93
docs(speed): add R2 egress caveat and reference architecture link per…
dmmulroy 6111dec
fix(speed-cache): correct Argo billing claims, R2 egress scope, Argo …
dmmulroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
62 changes: 62 additions & 0 deletions
62
src/content/docs/cache/troubleshooting/common-cache-issues.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| pcx_content_type: troubleshooting | ||
| title: Common cache issues | ||
| description: Fix common Cloudflare cache issues. | ||
| sidebar: | ||
| order: 2 | ||
| --- | ||
|
|
||
| This page covers common cache issues related to session management and cache configuration. | ||
|
|
||
| ## Session or login issues after enabling Cloudflare | ||
|
|
||
| Cloudflare does not store or manage session state for your application. Session information — typically stored in cookies — is proxied between the visitor and your origin server without modification by default. However, certain Cloudflare features can interfere with session persistence if your application is not configured to account for them. | ||
|
|
||
| ### Cached responses strip cookies | ||
|
|
||
| By default, Cloudflare only caches [specific static file extensions](/cache/concepts/default-cache-behavior/#default-cached-file-extensions) such as images, stylesheets, and JavaScript files. These file types do not normally carry session cookies, so default caching does not affect sessions. | ||
|
|
||
| However, if you use a [Cache Rule](/cache/how-to/cache-rules/) to cache additional content types (for example, HTML pages), Cloudflare may serve those responses from cache without the original `Set-Cookie` headers from your origin. This can break session-dependent pages. | ||
|
|
||
| **To resolve this:** | ||
|
|
||
| - Do not cache URLs that set or require cookies for session management. Use a Cache Rule with a [bypass condition based on cookie presence](/cache/how-to/cache-rules/examples/bypass-cache-on-cookie/) to exclude authenticated or session-dependent pages. | ||
| - Confirm that your origin application does not require cookies on any URL that Cloudflare is caching. Review the `CF-Cache-Status` header to determine which URLs are being served from cache. | ||
|
|
||
| ### IP-based session persistence breaks behind a reverse proxy | ||
|
|
||
| Some applications use the visitor's IP address as part of session tracking. Because Cloudflare operates as a reverse proxy, your origin server sees Cloudflare IP addresses instead of the visitor's real IP. If your application ties sessions to the client IP, sessions may break or rotate unexpectedly. | ||
|
|
||
| **To resolve this:** | ||
|
|
||
| - Configure your origin to read the visitor's real IP from the [`CF-Connecting-IP`](/fundamentals/reference/http-headers/#cf-connecting-ip) or `X-Forwarded-For` request header instead of the TCP source address. | ||
| - Refer to [Restoring visitor IPs](/support/troubleshooting/restoring-visitor-ips/) for server-specific configuration guides (Apache, Nginx, IIS, and others). | ||
| - If possible, switch your application to cookie-based session tracking instead of IP-based tracking. | ||
|
|
||
| ### Workers or Transform Rules modify headers | ||
|
|
||
| If you have [Cloudflare Workers](/workers/), [Transform Rules](/rules/transform/), or legacy Page Rules active, they can modify request or response headers — including `Set-Cookie` and `Cookie` headers. Review these configurations if sessions break after adding or changing rules. | ||
|
|
||
| ## Verifying whether Cloudflare is caching a URL | ||
|
|
||
| To check whether a specific URL is being cached: | ||
|
|
||
| 1. Make a request to the URL and inspect the response headers for [`CF-Cache-Status`](/cache/concepts/cache-responses/). | ||
| 2. If the header is absent, the response may not have passed through Cloudflare's cache layer. Common causes include the DNS record not being set to **Proxied** (orange cloud), a Worker returning a response before the cache phase, or a WAF/redirect rule acting on the request. Verify your DNS proxy status first. | ||
| 3. If the header value is `DYNAMIC`, Cloudflare does not consider the URL cacheable by default. You can create a [Cache Rule](/cache/how-to/cache-rules/) to cache it. | ||
| 4. If the header value is `HIT`, the response was served from Cloudflare's cache. | ||
|
|
||
| ## Stale or incorrect content served from cache | ||
|
|
||
| If you see outdated content being served: | ||
|
|
||
| 1. [Purge the cache](/cache/how-to/purge-cache/) for the affected URL or your entire zone. | ||
| 2. After purging, make a new request and verify the `CF-Cache-Status` header shows `MISS` (indicating a fresh fetch from origin). | ||
| 3. If the issue persists after purging, the problem may be at your origin server. [Temporarily pause Cloudflare](/fundamentals/manage-domains/pause-cloudflare/) to test the origin response directly. | ||
| 4. If the origin response is also incorrect, the issue is in your application or server configuration, not Cloudflare's cache. | ||
|
|
||
| If you need additional help with a caching issue, include: | ||
|
|
||
| - The affected URL. | ||
| - The `CF-Cache-Status` and `CF-Ray` header values from the response. | ||
| - A [HAR file](/support/troubleshooting/general-troubleshooting/gathering-information-for-troubleshooting-sites/) captured while reproducing the issue. |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.