Skip to main content
🎓 Claude Code Masterclass Learn AI-assisted development on Udemy — plus the companion book on Leanpub & Amazon. Start Learning
Configuring OpenClaw Gateway bind and Control UI
AI

Fix OpenClaw Origin Not Allowed — Gateway Bind Guide

Fix OpenClaw 'origin not allowed' errors. Configure gateway.bind (loopback, LAN, Tailscale) and gateway.controlui.allowedOrigins with step-by-step examples.

LB
Luca Berton
· 3 min read

Understanding Gateway Bind Modes

One of the first configuration hurdles with OpenClaw on Azure is understanding the --bind parameter. Unlike a simple IP address (e.g., 0.0.0.0), OpenClaw uses named bind modes:

ModeBehaviorUse Case
loopbackBinds to 127.0.0.1 onlySSH tunnel access (most secure)
lanBinds to all network interfacesDirect LAN/public access
tailnetBinds to Tailscale interfaceZero-config VPN access
autoOpenClaw decides based on environmentAutomatic detection
customCustom bind address (requires additional config)Advanced setups

Setting the bind mode

In your .env file on the VM:

# For SSH tunnel access (recommended)
OPENCLAW_GATEWAY_BIND=loopback

# For direct public/LAN access
OPENCLAW_GATEWAY_BIND=lan

Common mistake: Setting OPENCLAW_GATEWAY_BIND=0.0.0.0 will fail with:

Invalid --bind (use "loopback", "lan", "tailnet", "auto", or "custom")

Use lan instead of 0.0.0.0.


The Control UI Origin Enforcement

When you bind to a non-loopback address (e.g., lan), OpenClaw enforces browser-origin checks on the Control UI. This prevents unauthorized browsers from connecting to your dashboard via DNS rebinding or cross-origin attacks.

Without proper origin configuration, you’ll see this crash loop:

Gateway failed to start: Error: non-loopback Control UI requires
gateway.controlUi.allowedOrigins (set explicit origins), or set
gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true
to use Host-header origin fallback mode

You have two options to fix this:


Set a specific list of trusted origins:

cd ~/openclaw

docker compose run --rm openclaw-cli config set \
  gateway.controlUi.allowedOrigins \
  '["http://<VM_PUBLIC_IP>:18789","http://<VM_PRIVATE_IP>:18789","http://localhost:18789","http://127.0.0.1:18789"]'

Replace <VM_PUBLIC_IP> and <VM_PRIVATE_IP> with your actual IPs:

# Get your public IP
curl -s ifconfig.me; echo

# Get your private IP
hostname -I
  • Explicitly defines which browser origins can connect
  • Protects against DNS rebinding attacks
  • No security warnings in the gateway logs
  • Works with Azure NSG restrictions for defense in depth

Option B: Host-Header Origin Fallback (Quick but less secure)

If you want to get running immediately:

docker compose run --rm openclaw-cli config set \
  gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback true

This tells OpenClaw to trust the Host header from the browser request instead of checking against an explicit allowlist.

When this is acceptable

  • You restrict access via Azure NSG to your IP only
  • You’re behind a reverse proxy that sets proper headers
  • You’re in a development/testing environment
  • You understand the DNS rebinding risk

The security warning

With this flag enabled, you’ll see:

[gateway] security warning: dangerous config flags enabled:
gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true.
Run openclaw security audit.

This is expected and serves as a reminder to lock down access through other means.


Applying Configuration Changes

After any config change, restart the gateway:

docker compose down
docker compose up -d --force-recreate
docker compose ps
docker compose logs --tail=50 openclaw-gateway

Verify the gateway stays Up (not Restarting):

# Check multiple times over ~60 seconds
docker compose ps
# Wait 15 seconds
docker compose ps
# Wait 15 seconds 
docker compose ps

For SSH tunnel access (most secure)

# .env
OPENCLAW_GATEWAY_BIND=loopback
OPENCLAW_GATEWAY_PORT=18789

No origin configuration needed — loopback mode skips the origin check.

Access via SSH tunnel:

# From your laptop
ssh -L 18789:127.0.0.1:18789 azureuser@<VM_PUBLIC_IP>
# Then open http://127.0.0.1:18789

For direct public access

# .env
OPENCLAW_GATEWAY_BIND=lan
OPENCLAW_GATEWAY_PORT=18789

Plus explicit origins:

docker compose run --rm openclaw-cli config set \
  gateway.controlUi.allowedOrigins \
  '["http://<VM_PUBLIC_IP>:18789"]'

Plus Azure NSG rule restricting TCP 18789 to your IP.


Configuration Reference

View your current configuration:

docker compose run --rm openclaw-cli config get

Key gateway settings:

Config KeyDefaultDescription
gateway.controlUi.enabledtrueEnable/disable the Control UI
gateway.controlUi.basePath/URL prefix for the UI (e.g., /openclaw)
gateway.controlUi.allowedOrigins[]Browser-origin allowlist
gateway.controlUi.dangerouslyAllowHostHeaderOriginFallbackfalseHost-header fallback mode
gateway.controlUi.allowInsecureAuthfalseAllow token-only auth over HTTP
gateway.controlUi.dangerouslyDisableDeviceAuthfalseDisable device identity checks

Next Steps

With the gateway properly configured, let’s connect a Discord bot: Connecting OpenClaw to Discord on Azure.

Frequently Asked Questions

What does “Origin not allowed” mean in OpenClaw?

This error occurs when you access the OpenClaw Control UI from a hostname or IP not listed in gateway.controlui.allowedOrigins. Fix it by running: openclaw config set gateway.controlui.allowedOrigins your-hostname:port

How do I change OpenClaw gateway bind mode?

Run openclaw config set gateway.bind followed by the mode: loopback (default, localhost only), lan (local network), tailnet (Tailscale), auto (auto-detect), or a custom IP:port.

Do I need to restart after changing bind settings?

Yes. Run openclaw gateway restart after any configuration change to gateway.bind or gateway.controlui settings.

#openclaw #gateway #configuration #azure #networking #security #cors #docker
Share:
Cloud Infrastructure Design

Need help with Cloud Infrastructure Design?

Build resilient, cost-effective cloud environments with expert architecture consulting.

Learn more about Cloud Infrastructure Design

Want to operate this yourself, in production?

Take the free AI Platform Engineer Readiness Scorecard to see which skills transfer — then build a production-shaped AI platform in the 4-week Bootcamp.

Take the Scorecard →
Luca Berton — The Production AI Expert, Docker Captain

Luca Berton

The Production AI Expert · Docker Captain · KubeCon Speaker

15+ years in enterprise infrastructure. Author of 8 technical books, creator of Ansible Pilot (1M+ YouTube views, 648K site users). Former Red Hat engineer. Speaker at KubeCon EU 2026 and Red Hat Summit 2026.

Free 30-min Production AI consultation

Book Now