swadhinbiswas Add Caddy TLS config for the live API · 9/12/2026
5806c53
30 lines · 881 Bytes
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
# Live API gateway — terminates TLS in front of the collector's FastAPI.
#
#   collector (systemd)  ->  127.0.0.1:8090
#   Caddy                ->  https://vps.swadhin.cv  (auto Let's Encrypt)
#
# Install:  cp deploy/Caddyfile /etc/caddy/Caddyfile && systemctl reload caddy
# (Caddy obtains and renews the certificate automatically; ports 80 + 443 must
#  be reachable from the internet for the ACME challenge.)

vps.swadhin.cv {
	# The live snapshot is a ~3 MB JSON payload polled every few seconds;
	# compressing it cuts bandwidth by ~10x for negligible CPU.
	encode zstd gzip

	reverse_proxy 127.0.0.1:8090

	header {
		Strict-Transport-Security "max-age=31536000; includeSubDomains"
		X-Content-Type-Options "nosniff"
		Referrer-Policy "no-referrer"
		-Server
	}

	# Access logs go to the systemd journal: journalctl -u caddy -f
	log {
		output stderr
		format console
	}
}