| # Caddyfile — HF Spaces reverse proxy | |
| # OpenClaw :18889 (internal) ← main API | |
| # cc-switch-web :3000 (internal) ← Web UI | |
| # External port from $PORT environment variable | |
| :{env.PORT} { | |
| # cc-switch-web Web UI | |
| handle /ccswitch/* { | |
| uri strip_prefix /ccswitch | |
| reverse_proxy localhost:3000 | |
| } | |
| handle /ccswitch { | |
| redir /ccswitch/ 308 | |
| } | |
| # OpenClaw Gateway (API + Control UI) | |
| handle { | |
| reverse_proxy localhost:18889 { | |
| # WebSocket support for OpenClaw | |
| header_up Host {host} | |
| header_up X-Real-IP {remote_host} | |
| header_up X-Forwarded-For {remote_host} | |
| header_up X-Forwarded-Proto {scheme} | |
| } | |
| } | |
| } |