Skip to content

Handle expired Cloudflare Access session in SPA fetches #4

Description

@chrispezza

Per ADR-009's known negative: once barback.pezza.dev is behind Cloudflare Access, an expired Access session (~monthly at a 30-day session) makes background fetch calls to /bar/ and /search/ receive an HTML login redirect instead of JSON. Without handling, this surfaces as opaque query failures until the user happens to reload.

  • Detect the condition at the API-client boundary (e.g. non-JSON content-type or a redirect to the Access login on a request that expected JSON)
  • Surface a clear "session expired — reload to sign in" state (toast or banner with a reload action) instead of generic query errors
  • Keep it inert on LAN/dev origins where Access is not in the path
  • TanStack Query note: mark the condition non-retryable so it fails fast rather than burning retries

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementType: new capability or improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions