# The game as static files (CR-014): it runs and saves on the player's device.
# SITE_ADDRESS is the public domain (HTTPS via Let's Encrypt), or ":80" for
# plain HTTP when testing.
{$SITE_ADDRESS} {
	encode zstd gzip

	root * /srv
	# Client-side routes (/fleet, /contracts…) all load the app.
	try_files {path} /index.html
	file_server

	# Vite's hashed bundles and fonts never change under the same name.
	@hashed path_regexp hashed ^/assets/[^/]+-[A-Za-z0-9_-]{8}\.(js|css|woff2?)$
	header @hashed Cache-Control "public, max-age=31536000, immutable"

	# The shell and service worker must always be checked for a new version.
	@shell path / /index.html /sw.js /registerSW.js /manifest.webmanifest
	header @shell Cache-Control "no-cache"
}
