disconnected (1008): Invalid or missing token when using Cloudflare Access with custom domain
Author: axelweichertCreated Mar 18, 2026Updated Mar 24, 2026
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
- Deploy moltworker with Cloudflare Access enabled
- Set MOLTBOT_GATEWAY_TOKEN as a secret
- Configure a custom domain (e.g. moltbot.example.com) with Cloudflare Access
- Visit https://moltbot.example.com/?token=YOUR_TOKEN
- After Cloudflare Access authentication, the token is stripped from the URL
- 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.
Source: cloudflare/moltworker