# One public address for everything: the chat site and its Supabase API.
# Cloudflare Tunnel points at this (port 8080).
:8080 {
	encode gzip

	# Supabase API (local Supabase CLI stack on the host, port 54321)
	@api path /rest/v1/* /auth/v1/* /realtime/v1/* /functions/v1/* /storage/v1/*
	handle @api {
		reverse_proxy host.docker.internal:54321
	}

	# Chat site (built files), single-page app fallback
	handle {
		root * /srv
		try_files {path} /index.html
		file_server
		header /config.js Cache-Control "no-store"
	}

	header {
		X-Content-Type-Options nosniff
		Referrer-Policy strict-origin-when-cross-origin
		-Server
	}
}
