Repository navigation
Expand file tree
/
Copy pathCaddyfile
More file actions
59 lines (47 loc) · 1.55 KB
/
Copy pathCaddyfile
File metadata and controls
59 lines (47 loc) · 1.55 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Caddyfile for TLS termination
# Environment variables: PUBLIC_DOMAIN, PROXY_HOST
{$PUBLIC_DOMAIN:localhost} {
# Automatic HTTPS with Let's Encrypt (production)
# For local development with self-signed cert, Caddy will auto-generate
# Reverse proxy to the authsec-openclaw-proxy
reverse_proxy {$PROXY_HOST:proxy:8080} {
# Preserve original request information
header_up Host {host}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-Host {host}
# WebSocket support
header_up Connection {>Connection}
header_up Upgrade {>Upgrade}
# Health check
health_uri /healthz
health_interval 30s
health_timeout 10s
}
# Security headers
header {
# Enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Prevent clickjacking
X-Frame-Options "SAMEORIGIN"
# Prevent MIME sniffing
X-Content-Type-Options "nosniff"
# XSS protection
X-XSS-Protection "1; mode=block"
# Referrer policy
Referrer-Policy "strict-origin-when-cross-origin"
# Remove server header
-Server
}
# Logging
log {
output stdout
format json
level INFO
}
}
# HTTP to HTTPS redirect for production
http://{$PUBLIC_DOMAIN:localhost} {
redir https://{host}{uri} permanent
}