| [ Web Proxy ] |
| Viewing: https://developers.cloudflare.com/cache/troubleshooting/dynamic-content-and-login-issues/ | [Back] [Original] |
Dynamic pages such as login forms, checkout flows, and authenticated application routes can break when they are cached too aggressively.
Common symptoms include:
Set-Cookie header, but the browser never stores the cookie.One common cause is a Cache Rule or legacy Page Rule configured to cache dynamic HTML.
This usually happens when all of the following are true:
/login or /account.Set-Cookie header.In this configuration, Cloudflare can cache the response and remove the Set-Cookie header before the response is stored at the edge. As a result, the browser receives the login page but never gets the session cookie required for the next request.
Check the response for the login page or other dynamic route.
If you see both of the following, the page is probably cached when it should not be:
CF-Cache-Status: HIT or CF-Cache-Status: EXPIREDSet-Cookie header in the response, even though your origin usually sets oneYou may also see framework-specific failures after form submission, for example:
403 or 500 after sign-inThis issue is common with frameworks that rely on a session or CSRF cookie on the first page load, including JavaServer Faces, ASP.NET, PHP session handlers, Django, Rails, and Laravel.
Do not cache login pages or other authenticated HTML.
Instead:
/login, /account, /cart, /checkout, and application API paths.CF-Cache-Status: DYNAMIC, MISS, or BYPASS, and preserves Set-Cookie.For more information on cookie behavior, refer to Interaction of Set-Cookie response header with Cache.
Security challenges can also interrupt dynamic flows.
Two common patterns are:
GET request for the login page. The user solves the challenge, but the application loses the original session or CSRF context.POST request that submits the login form or other sensitive action. The browser may have to repeat the request after the challenge, which can break the original form submission.Check whether a WAF custom rule, managed rule, or rate limiting rule applies to the login path.
If the issue only affects routes such as /login, /signin, /checkout, or /api/auth/*, and the application works when the challenge is disabled for those paths, the challenge is likely interrupting the flow.
Use one of the following approaches:
When debugging, also verify that rules are not matching Cloudflare-generated paths such as /cdn-cgi/*.
For more information on challenge-related behavior, refer to Rules troubleshooting and Cloudflare WAF troubleshooting.
| Web Proxy Viewer | New URL | Original Page |