forked from wrenn/wrenn
WIP: Add Caddy reverse proxy for dev environment
Add Caddy to docker-compose as the single entry point on port 8000: - localhost -> /api/* stripped and proxied to CP:8080, /* to frontend:5173 - *.localhost -> proxied to CP:8080 (sandbox proxy catch-all) - Direct /v1/*, /auth/*, /docs routes proxied to CP Move CP from :8000 to :8080 (its default). Caddy takes :8000. Update .env.example, vite proxy target (kept as fallback), and Makefile dev targets (pg_isready via docker exec, frontend binds 0.0.0.0). This is an intermediate state — needs further work for the full code interpreter feature.
This commit is contained in:
41
deploy/Caddyfile.dev
Normal file
41
deploy/Caddyfile.dev
Normal file
@ -0,0 +1,41 @@
|
||||
# Sandbox port forwarding: {port}-{sandbox_id}.localhost
|
||||
# Matches subdomains like 49999-sb-abcd1234.localhost and proxies them
|
||||
# to the control plane, which inspects the Host header and routes to
|
||||
# the correct host agent.
|
||||
#
|
||||
# NOTE: Wildcard *.localhost DNS resolution requires local setup.
|
||||
# Option 1: Add entries to /etc/hosts for each sandbox
|
||||
# Option 2: Use dnsmasq: address=/.localhost/127.0.0.1
|
||||
# Option 3: Use systemd-resolved (Ubuntu default — *.localhost resolves to 127.0.0.1)
|
||||
http://*.localhost {
|
||||
reverse_proxy host.docker.internal:8080
|
||||
}
|
||||
|
||||
# Main entry point: API + frontend
|
||||
http://localhost {
|
||||
# API routes — strip /api prefix and proxy to the control plane.
|
||||
# The frontend calls /api/v1/... which becomes /v1/... at the CP.
|
||||
handle_path /api/* {
|
||||
reverse_proxy host.docker.internal:8080
|
||||
}
|
||||
|
||||
# Backend routes served directly (SDK clients, OAuth initiation)
|
||||
handle /v1/* {
|
||||
reverse_proxy host.docker.internal:8080
|
||||
}
|
||||
handle /openapi.yaml {
|
||||
reverse_proxy host.docker.internal:8080
|
||||
}
|
||||
handle /docs {
|
||||
reverse_proxy host.docker.internal:8080
|
||||
}
|
||||
handle /auth/oauth/* {
|
||||
reverse_proxy host.docker.internal:8080
|
||||
}
|
||||
|
||||
# Everything else — proxy to the frontend dev server
|
||||
# This includes: /login, /dashboard/*, /admin/*, /auth/github/callback
|
||||
handle {
|
||||
reverse_proxy host.docker.internal:5173
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user