-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCaddyfile
More file actions
73 lines (65 loc) · 2.67 KB
/
Caddyfile
File metadata and controls
73 lines (65 loc) · 2.67 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Caddyfile for local HTTPS development
# Caddy automatically generates local certificates
(security_headers) {
header {
# HSTS - enforce HTTPS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Prevent MIME type sniffing
X-Content-Type-Options "nosniff"
# Clickjacking protection
X-Frame-Options "DENY"
# XSS protection (legacy browsers)
X-XSS-Protection "1; mode=block"
# Referrer policy
Referrer-Policy "strict-origin-when-cross-origin"
# Permissions policy (disable unused features)
Permissions-Policy "geolocation=(), microphone=(), camera=()"
# Content Security Policy for Porto SDK
Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https://rpc.porto.sh https://*.porto.sh wss://*.porto.sh; frame-src https://id.porto.sh; frame-ancestors 'none';"
# Remove server header
-Server
}
}
# =============================================================================
# Production domain: villa.cash
# DNS: CloudFlare → DigitalOcean (handled by DO, not Caddy)
# =============================================================================
villa.cash {
import security_headers
reverse_proxy app:3000
}
www.villa.cash {
redir https://villa.cash{uri} permanent
}
# =============================================================================
# Staging domain: beta.villa.cash
# =============================================================================
beta.villa.cash {
import security_headers
reverse_proxy app:3000
}
# =============================================================================
# Dev domains: dev-1, dev-2, dev-3
# =============================================================================
dev-1.villa.cash, dev-2.villa.cash, dev-3.villa.cash {
import security_headers
reverse_proxy app:3000
}
# =============================================================================
# Local development
# =============================================================================
localhost {
import security_headers
reverse_proxy app:3000
}
# Alternative: use villa.local (add to /etc/hosts: 127.0.0.1 villa.local)
villa.local {
import security_headers
reverse_proxy app:3000
}
# =============================================================================
# Legacy domain redirect
# =============================================================================
proofofretreat.me, www.proofofretreat.me {
redir https://villa.cash{uri} permanent
}