# Production-ish static server for the built site. # # server/caddy.exe run --config server/Caddyfile # # Get caddy.exe with server/get-caddy.ps1 (it is gitignored -- 47 MB binary). # # Compared with serve.py this adds ETags, compression, and concurrency that # scales instead of collapsing. Everything here is static files; there is no # application server. # # Note: this is plain HTTP, so HTTP/2 is NOT active -- browsers only negotiate # h2 over TLS. The speedup over serve.py is Go's I/O, not h2. Turning on # `tls internal` would enable h2/h3 but every phone would need Caddy's local # CA installed, which is not worth it on a LAN. { admin off auto_https off } :{$TARKOVMAP_PORT:8080} { root * ../web encode zstd gzip # Tiles are rewritten wholesale by tools/build.py and never edited in # place, so a long lifetime is safe. `immutable` stops the browser # revalidating them on every pan. @tiles path /tiles/* header @tiles Cache-Control "public, max-age=604800, immutable" # The shell and the manifest must never be stale, or the app can end up # pointing at tiles that no longer exist. @shell path / /index.html /app.js /style.css /data/* header @shell Cache-Control "no-cache" # Leaflet skips a tile that 404s; without this an out-of-bounds request # logs an error page instead of failing quietly. handle_errors { respond "" {http.error.status_code} } file_server }