Skip to content

disconnected (1008): Invalid or missing token when using Cloudflare Access with custom domain #324

Description

@axelweichert

Problem

When using Cloudflare Access with a custom domain, the ?token= query parameter
is stripped during the Access redirect, causing a 1008 "Invalid or missing token"
error in the Chat UI.

Steps to reproduce

  1. Deploy moltworker with Cloudflare Access enabled
  2. Set MOLTBOT_GATEWAY_TOKEN as a secret
  3. Configure a custom domain (e.g. moltbot.example.com) with Cloudflare Access
  4. Visit https://moltbot.example.com/?token=YOUR_TOKEN
  5. After Cloudflare Access authentication, the token is stripped from the URL
  6. Chat UI shows: disconnected (1008): Invalid or missing token

Expected behavior

The token should be preserved after the Cloudflare Access redirect,
or the UI should store the token in sessionStorage/localStorage before the redirect.

Environment

  • Custom domain with Cloudflare Access (Azure AD / Entra ID)
  • Workers Paid plan
  • Latest version of moltworker (forked from cloudflare/moltworker)

Workaround

None found. The /_admin/ page works correctly with Cloudflare Access.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions