nginx.conf
Rama main · réplica de lectura del repositorio original.
server {
listen 80;
# Serve web static files
root /wally/web;
index index.html;
gzip on;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_types application/json application/javascript text/javascript text/css image/svg+xml application/manifest+json;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy same-origin always;
add_header X-Frame-Options SAMEORIGIN always;
# Every file is checked with the server before it is used (a quick 304 when unchanged), so after
# an upgrade the browser never mixes old and new scripts. Set here, once: nginx drops the
# headers above in any location that adds its own.
add_header Cache-Control "no-cache" always;
# Proxy /api/ requests to FastAPI, without the /api prefix (uvicorn runs with --root-path /api,
# so the docs at /api/docs link to the right places)
location /api/ {
proxy_pass http://127.0.0.1:8000/;
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;
client_max_body_size 64m;
}
# The service worker is never the app's page
location = /sw.js {
try_files $uri =404;
}
# The app's page, matched exactly so the old 1.x redirects below never catch it
location = /index.html {
}
# Files keep their name; everything else is the app's one page (/transactions, /settings/people...)
location / {
try_files $uri /index.html;
}
# Old 1.x pages
location = /login { return 301 /; }
location ~ ^/(index|transactions|settings|login)\.html$ { return 301 /$1; }
}