raycer/frontend/nginx.conf
Spencer Flagg ed3a0d3ea3 Initial commit: raycer accountability PWA
Vanilla HTML/JS/CSS PWA with Dexie offline-first sync, Hono+SQLite backend,
served via nginx reverse-proxy. Two seed goals (no-sugar, no-social-media)
for users ray and cer.

Local dev runs at https://raycer.test via the shared Traefik proxy.
Production deploys to https://raycer.altweb.me on cool2026/personal via
docker-compose.coolify.yaml — see deploy/COOLIFY.md.
2026-04-23 16:45:06 +02:00

41 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Don't cache the entrypoints / SW / manifest so updates roll out
location = /index.html {
add_header Cache-Control "no-cache, must-revalidate" always;
}
location = /sw.js {
add_header Cache-Control "no-cache, must-revalidate" always;
add_header Service-Worker-Allowed "/" always;
}
location = /manifest.webmanifest {
add_header Cache-Control "no-cache" always;
types { } default_type application/manifest+json;
}
# Static assets: short cache (the SW does the heavy caching)
location /css/ { add_header Cache-Control "public, max-age=300"; try_files $uri =404; }
location /js/ { add_header Cache-Control "public, max-age=300"; try_files $uri =404; }
location /icons/ { add_header Cache-Control "public, max-age=86400"; try_files $uri =404; }
# API: proxy to backend container
location /api/ {
proxy_pass http://backend:3000/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 30s;
}
# SPA fallback: any other path → index.html (History API routing)
location / {
try_files $uri $uri/ /index.html;
}
}