Spaces:
Running
Running
File size: 1,076 Bytes
cd61bf7 | 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 | # Replace 'yourdomain.com' with your actual domain
yourdomain.com {
# Enable automatic HTTPS with Let's Encrypt
tls {
# Email for Let's Encrypt notifications
email admin@yourdomain.com
}
# Reverse proxy to backend
reverse_proxy backend:8000 {
header_up X-Real-IP {remote}
header_up X-Forwarded-For {remote}
header_up X-Forwarded-Proto {scheme}
}
# Enable gzip compression
encode gzip
# Logging
log {
output file /var/log/caddy/access.log
format json
}
# Security headers
header {
# Enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Prevent clickjacking
X-Frame-Options "SAMEORIGIN"
# XSS protection
X-Content-Type-Options "nosniff"
# Referrer policy
Referrer-Policy "strict-origin-when-cross-origin"
# Remove server header
-Server
}
}
# Optional: Redirect www to non-www
www.yourdomain.com {
redir https://yourdomain.com{uri} permanent
}
|