-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCaddyfile
More file actions
32 lines (27 loc) · 1.02 KB
/
Caddyfile
File metadata and controls
32 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
# Prevent Caddy from trying to claim port 80 for HTTP→HTTPS redirects
auto_https disable_redirects
}
# Proxy to Electric on port 3000 with HTTP/2 (requires HTTPS via Caddy's local CA)
# One-time setup: caddy start && caddy trust && caddy stop
# Chrome on Linux: manually import ~/.local/share/caddy/pki/authorities/local/root.crt
# via chrome://settings/certificates → Authorities → Import
# This is only for development; in production, Caddy would handle HTTPS directly and proxy to the backend over HTTP
localhost:3001 {
header Access-Control-Allow-Origin *
header Access-Control-Allow-Methods "GET, OPTIONS"
header Access-Control-Allow-Headers *
@options method OPTIONS
respond @options 204
@notOptions not method OPTIONS
forward_auth @notOptions localhost:3003 {
uri /auth/electric/check
}
reverse_proxy localhost:3000 {
# Disable buffering so SSE events are flushed immediately
flush_interval -1
# Strip upstream CORS header before we set our own *
header_down -Access-Control-Allow-Origin
}
encode gzip
}