# Smart Transcode behind Caddy, with automatic HTTPS (Let's Encrypt). Works for both:
#   - Caddy on the host: replace the domain below (or set SMART_TRANSCODE_DOMAIN) and run Caddy; the app is the
#     Linux service, or a container with "127.0.0.1:8080:8080";
#   - caddy/docker-compose.yml: the domain and the app ("smart-transcode:8080") come from the environment.
# In Smart Transcode: Settings > Security > Reverse proxies: add the address Caddy connects from (127.0.0.1 on the
# host; 172.30.0.10 with the compose file). See docs/reverse-proxy.md.
#
# Caddy keeps the Host header and sets X-Forwarded-For / X-Forwarded-Proto / X-Forwarded-Host by itself, and
# ignores X-Forwarded-For sent by clients.

{$SMART_TRANSCODE_DOMAIN:transcode.example.com} {
	reverse_proxy {$SMART_TRANSCODE_UPSTREAM:127.0.0.1:8080} {
		# Some pages ask for a whole library at once: allow slow answers on a busy disk.
		transport http {
			response_header_timeout 300s
		}
	}
}
