-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathCaddyfile
More file actions
47 lines (42 loc) · 1.35 KB
/
Caddyfile
File metadata and controls
47 lines (42 loc) · 1.35 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
# =============================================================================
# Caddyfile - Reverse Proxy with Automatic HTTPS
# =============================================================================
#
# Usage:
# 1. Replace {$DOMAIN} with your actual domain, or set DOMAIN in .env
# 2. Ensure DNS points to your EC2 instance
# 3. Caddy will automatically obtain and renew SSL certificates
#
# For local testing without SSL, use: localhost instead of {$DOMAIN}
#
# =============================================================================
{$DOMAIN:localhost} {
# Reverse proxy to the app
reverse_proxy app:3000
# Enable compression
encode gzip zstd
# Security headers
header {
# Enable HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Prevent clickjacking
X-Frame-Options "SAMEORIGIN"
# Prevent MIME type 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 console
}
}
# Redirect www to non-www (optional - uncomment if needed)
# www.{$DOMAIN} {
# redir https://{$DOMAIN}{uri} permanent
# }