Fixing WebSocket Connection and Origin Errors | Generated by AI

Home 2026.03

HTTP is fine for your case — the ws:// error is NOT caused by using HTTP. Here’s why:

The real cause is still the server-side origin check rejecting the connection and closing it immediately — that’s what produces “closed before connection established.” The most common causes per the search results:

  1. CORS/Origin misconfiguration — server rejects the origin header (your case)
  2. Invalid port/host — mismatch between what the client connects to and what the server listens on
  3. Server not configured for WebSocket upgrades

Check if your config changes actually saved:

openclaw config get gateway.controlUi

If allowedOrigins or dangerouslyDisableDeviceAuth aren’t there, re-run:

openclaw config set gateway.controlUi.allowedOrigins '["*"]'
openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true
systemctl --user restart openclaw-gateway.service

Then check the gateway logs for the actual rejection reason:

journalctl --user -u openclaw-gateway.service -n 100 --no-pager | grep -i "origin\|closed\|reject\|error"

Sources:


Back Donate