Skip to content

Commit b80bbbe

Browse files
committed
opt: ultimate Caddyfile with trusted proxies and enhanced security
1 parent 2213522 commit b80bbbe

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

config/Caddyfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
admin off
99
persist_config off
1010

11+
# Trust private network ranges for Fly.io
12+
servers {
13+
trusted_proxies static private_ranges
14+
}
15+
1116
log {
1217
level INFO
1318
output stdout
@@ -30,19 +35,26 @@
3035

3136
# Security headers
3237
header {
38+
# Infrastructure security
3339
Strict-Transport-Security "max-age=31536000;"
34-
X-XSS-Protection "1; mode=block"
40+
X-Content-Type-Options "nosniff"
3541
X-Frame-Options "DENY"
42+
X-XSS-Protection "1; mode=block"
43+
44+
# Privacy & Permissions
45+
Referrer-Policy "strict-origin-when-cross-origin"
46+
Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()"
3647
X-Robots-Tag "noindex, nofollow"
37-
X-Content-Type-Options "nosniff"
48+
49+
# Fingerprint removal
3850
-Server
3951
-X-Powered-By
4052
-Last-Modified
4153
}
4254

4355
reverse_proxy localhost:8080 {
44-
header_up X-Real-IP {http.request.header.CF-Connecting-IP:{http.request.header.Fly-Client-IP:{remote_host}}}
45-
header_up X-Forwarded-For {http.request.header.CF-Connecting-IP:{http.request.header.Fly-Client-IP:{remote_host}}}
56+
header_up X-Real-IP {http.request.header.Fly-Client-IP:{remote_host}}
57+
header_up X-Forwarded-For {http.request.header.Fly-Client-IP:{remote_host}}
4658
}
4759
}
4860
}

0 commit comments

Comments
 (0)