-
Notifications
You must be signed in to change notification settings - Fork 0
/
Caddyfile
53 lines (46 loc) · 1.41 KB
/
Caddyfile
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
{
# Set your email for Let's Encrypt notifications
email [email protected]
# Enable on-demand TLS (SSL certificates)
on_demand_tls {
ask https://lua.sh/api/v1/domains/validate
burst 5
interval 2m
}
# JSON format for structured logging
log {
output file /var/log/caddy_access.log { # Log to access log file
roll_size 100mb
roll_keep 5
roll_keep_for 720h
}
format json
}
}
# Redirect HTTP to HTTPS for all domains
http:// {
redir https://{host}{uri}
}
# Main HTTPS block for reverse proxying
https:// {
tls {
on_demand # Enable on-demand TLS (SSL certificates)
}
reverse_proxy https://lua.sh {
header_up Host lua.sh # Keep the upstream host as lua.sh
header_up Caddy-Custom-Domain {host} # Pass the original domain
header_up X-Forwarded-Port 443 # Forward the server port
header_up X-Real-IP {remote} # Pass the real client IP
header_up X-Forwarded-Proto {scheme} # Forward the scheme (HTTP/HTTPS)
health_timeout 5s # Set health check timeout
}
log {
output file /var/log/caddy_error.log { # Log to error log file
roll_size 100mb
roll_keep 5
roll_keep_for 720h
}
format json # Use JSON format for easier parsing
level ERROR # Log only errors for this block
}
}