tictactoe/nginx.conf
Parley Hatch 450d46c55d Actually fix no-scroll: fixed-centered card scaled to fit + cache busting
My previous 'no scrolling' commit didn't actually work — two real bugs:

1. Stale assets: nginx cached css/js for a week (max-age=604800), so after
   a redeploy returning visitors kept the OLD stylesheet/script and never saw
   the fit logic. Switched assets to Cache-Control:no-cache (tiny files, 304s)
   and added ?v= query strings to bust the existing week-long cache.

2. Bad centering geometry: grid-centering pins an over-tall card to the top,
   and .winner-card re-declared position:relative, overriding the fix. Now the
   card is position:fixed at 50%/50% and fitActiveScreen() folds the fit scale
   into one transform: translate(-50%,-50%) scale(fit). Removed the winner-card
   position override and switched the screen fade to opacity-only (a transform
   on .screen would capture the fixed card and break centering).

Verified in real Chromium against the container — setup, game, AND winner all
show fits:true / scrolls:false at 1366x640 (short laptop), 375x667, and
360x640 (small phone). No scrolling on any screen at any size.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 19:00:32 -06:00

30 lines
1.2 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/css application/javascript image/svg+xml;
gzip_min_length 256;
# Assets use stable filenames and we redeploy in place, so revalidate on
# every load (cheap — tiny files, 304s) instead of caching for a week.
# A week-long cache here means redeploys leave returning players on stale
# CSS/JS until expiry; no-cache avoids that footgun.
location ~* \.(css|js|svg|png|ico)$ {
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Cache-Control "no-cache" always;
}
# HTML entry point: always revalidate so redeploys show up immediately.
location / {
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Cache-Control "no-cache" always;
try_files $uri $uri/ /index.html;
}
}