# TLS, compression and the trusted-proxy header in front of a hosted studio.
# Caddy obtains and renews the certificate for STUDIO_DOMAIN on its own.
{$STUDIO_DOMAIN} {
	# WebAssembly (the click-to-edit runtime) and the app bundle compress well.
	encode zstd gzip

	# References and start frames ride in the request body.
	request_body {
		max_size 128MB
	}

	reverse_proxy studio:8765 {
		# Proves to the studio that x-forwarded-* came from this proxy and not
		# from a caller (api/hosts.py). Caddy sets X-Forwarded-For to the real
		# client and keeps the browser's Host.
		header_up X-Studio-Proxy-Secret {$CONTENT_STUDIO_PROXY_SECRET}
		header_up X-Forwarded-Host {host}
	}
}
