# Static landing container. Serves the public landing page and the built
# assets it references at /; the game SPA (/app/, /telegram/) and the Connect
# edge stay on the gateway. The contour caddy routes the catch-all here, so
# stray public paths are absorbed by static file serving and never reach the Go
# edge. This file is baked into the image at build time (gateway/Dockerfile,
# target `landing`), not bind-mounted.
{
	admin off
}

:80 {
	root * /srv
	encode zstd gzip

	# Mirror the gateway webui caching: hash-named build assets are immutable,
	# every HTML shell is no-cache so a new deploy is picked up immediately.
	header /assets/* Cache-Control "public, max-age=31536000, immutable"
	@shell not path /assets/*
	header @shell Cache-Control "no-cache"

	# The static public offer page, rendered from ui/legal/offer_ru.md at build
	# time into dist/offer/index.html (vite emit-offer plugin). Served with its own
	# index so /offer/ resolves to /srv/offer/index.html rather than falling to the
	# landing shell below (whose index is landing.html). A bare /offer redirects in.
	handle /offer {
		redir * /offer/ permanent
	}
	handle /offer/* {
		file_server {
			index index.html
		}
	}

	# An unknown path falls back to the landing shell (the gateway's old "/"
	# behaviour); "/" itself resolves through the index below.
	handle {
		try_files {path} /landing.html
		file_server {
			index landing.html
		}
	}
}
