- Route gRPC-Web requests to Orchestrator via h2c transport - Handle CORS preflight and response headers for cross-origin access - Proxy remaining traffic to SvelteKit dev server - Configurable via env vars: ORCHESTRATOR_HOST, UI_HOST, DOMAIN, CORS_ORIGIN Closes #3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
Issue #3: Configure Caddy for gRPC-Web support
Status: COMPLETED
Issue: #3
Branch: feature/issue-3-caddy-grpc-web
Summary
Create a Caddyfile that handles gRPC-Web translation, CORS headers, and proxies both gRPC-Web traffic to the Orchestrator and regular traffic to the SvelteKit dev server.
Acceptance Criteria
- Caddyfile with gRPC-Web reverse proxy configuration
- CORS headers configured for local dev and production origins
- Content-Type mapping for gRPC-Web ↔ gRPC translation
- grpc_web directive enabled (via content-type matching + h2c transport)
- Documented how to run Caddy alongside the orchestrator
- Browser can successfully call the Orchestrator through Caddy
Implementation
Single Caddyfile in the project root that:
- Routes
application/grpc-web*requests to the Orchestrator via h2c - Handles CORS preflight (OPTIONS) with configurable origin
- Adds CORS response headers for gRPC-Web responses
- Routes all other traffic to the SvelteKit dev server
- Configurable via environment variables: ORCHESTRATOR_HOST, UI_HOST, DOMAIN, TLS_MODE, CORS_ORIGIN
Deviations
- Caddy v2 doesn't have a built-in
grpc_webdirective. Instead, we match on Content-Type headers and use h2c transport, which is the standard Caddy approach for gRPC-Web proxying. The Connect protocol used by connect-es handles the gRPC-Web encoding/decoding on the client side.