Files
horizon-airdef/website/Caddyfile
T
Ludovic Marie 57ee531c63 Host a server: a guide in docs/hosting.md, and the site's /server page built from it
What works on main today (install, game files, first run, server.toml, the commands, the web panel,
backups, services, Docker built by hand) and, plainly, what doesn't yet: offline mode only, no
published image, no secure chat or locator bar, the open PRs that are coming. The site renders the
guide into /server at build time, so it has one source. The CSP hashes now cover every page's inline
script, so the privacy page's theme script is allowed too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 08:45:48 +02:00

45 lines
1.7 KiB
Caddyfile

# Serves dist/ on Railway's $PORT. Fingerprinted CSS and JS are cached for a year,
# media for a week, and the page itself is always revalidated. The site lives at
# https://playhorizon.dev: Railway's own *.up.railway.app address redirects there, so the
# page is indexed once. Railway's healthcheck (Host: healthcheck.railway.app) is still served.
{
admin off
auto_https off
persist_config off
}
:{$PORT:8080} {
root * /srv
@railway header_regexp Host ^[^.]+\.up\.railway\.app(:[0-9]+)?$
redir @railway https://playhorizon.dev{uri} permanent
encode zstd gzip
header {
X-Content-Type-Options nosniff
Referrer-Policy strict-origin-when-cross-origin
X-Frame-Options DENY
Permissions-Policy "interest-cohort=(), browsing-topics=(), camera=(), microphone=(), geolocation=()"
Content-Security-Policy "default-src 'self'; script-src 'self' {$CSP_SCRIPT}; style-src 'self' {$CSP_STYLE}; img-src 'self' data: https://avatars.githubusercontent.com; font-src 'self'; connect-src 'self' https://api.github.com https://raw.githubusercontent.com; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
-Server
}
@assets path /assets/*
header @assets Cache-Control "public, max-age=31536000, immutable"
@media path /media/* /fonts/* /og.png /favicon* /apple-touch-icon.png
header @media Cache-Control "public, max-age=604800"
rewrite /privacy /privacy.html
rewrite /server /server.html
@pages path / /index.html /404.html /privacy.html /server.html
header @pages Cache-Control "no-cache"
@legal path /LEGAL.md /fonts/*.txt
header @legal Content-Type "text/plain; charset=utf-8"
file_server {
hide .csp-script .csp-style og.html
}
handle_errors {
rewrite * /404.html
file_server
}
}