-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCaddyfile.example
More file actions
56 lines (47 loc) · 1.43 KB
/
Copy pathCaddyfile.example
File metadata and controls
56 lines (47 loc) · 1.43 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
# Caddyfile.example — Caddy reverse proxy for RemoteTTYs
#
# Replace "rttys.example.com" with your actual domain.
# Caddy will automatically obtain and renew TLS certificates via Let's Encrypt.
#
# Usage:
# cp Caddyfile.example Caddyfile
# # Edit the domain name below
# docker compose -f docker-compose-with-caddy.yml up -d
rttys.example.com {
encode gzip zstd
# deny robots
handle /robots.txt {
respond `User-agent: *
Disallow: /` 200
}
# Security headers
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Frame-Options "DENY"
Referrer-Policy "strict-origin-when-cross-origin"
Permissions-Policy "camera=(), microphone=(), geolocation=(), usb=()"
X-Robots-Tag "noindex, nofollow, noarchive"
-Server
}
# Limit request body size (WebSocket upgrades are exempt)
request_body {
max_size 1MB
}
reverse_proxy 172.17.0.1:8080 {
# Pass real client IP to backend for rate limiting
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
# Disable response buffering for real-time terminal I/O
flush_interval -1
# WebSocket: max session duration (terminal sessions can reconnect)
stream_timeout 24h
# Graceful delay before closing WebSocket on config reload
stream_close_delay 5s
# Upstream connection tuning
transport http {
keepalive 30s
keepalive_interval 15s
}
}
}