2026-05-13 14:08:11 +00:00
|
|
|
upstream tx_api {
|
2026-05-13 19:47:05 +00:00
|
|
|
server api:8080;
|
2026-05-13 14:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
server {
|
2026-05-13 19:47:05 +00:00
|
|
|
listen 80;
|
|
|
|
|
server_name _;
|
2026-05-13 14:08:11 +00:00
|
|
|
|
2026-05-13 19:47:05 +00:00
|
|
|
client_max_body_size 50m;
|
2026-05-13 14:08:11 +00:00
|
|
|
|
2026-05-13 19:47:05 +00:00
|
|
|
# WebSocket / Socket.IO upgrade for /api/socket.io
|
|
|
|
|
location /api/socket.io/ {
|
|
|
|
|
proxy_pass http://tx_api;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
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 3600s;
|
|
|
|
|
proxy_send_timeout 3600s;
|
|
|
|
|
}
|
2026-05-13 14:08:11 +00:00
|
|
|
|
2026-05-13 19:47:05 +00:00
|
|
|
# Forward all /api requests to the Node API server
|
|
|
|
|
location /api/ {
|
|
|
|
|
proxy_pass http://tx_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 300s;
|
|
|
|
|
proxy_send_timeout 300s;
|
|
|
|
|
}
|
2026-05-13 14:08:11 +00:00
|
|
|
|
2026-05-13 19:47:05 +00:00
|
|
|
# Static SPA assets with hashed filenames — cache aggressively
|
|
|
|
|
location /assets/ {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
expires 1y;
|
|
|
|
|
access_log off;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
}
|
2026-05-13 14:08:11 +00:00
|
|
|
|
2026-05-19 20:17:47 +00:00
|
|
|
# Service worker MUST never be cached so we can ship SW updates.
|
|
|
|
|
# Safari/iOS especially clings to old sw.js otherwise.
|
|
|
|
|
location = /sw.js {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
|
|
|
|
|
add_header Pragma "no-cache";
|
|
|
|
|
add_header Expires "0";
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# SPA fallback — every unknown path returns index.html.
|
|
|
|
|
# `no-cache` alone is unreliable on iOS Safari (sometimes the browser
|
|
|
|
|
# serves a stale copy after a deploy). Pair it with `no-store` + the
|
|
|
|
|
# legacy `Pragma`/`Expires` headers so every device — phones, iPads,
|
|
|
|
|
# laptops — re-fetches index.html and picks up the freshly-hashed
|
|
|
|
|
# assets/*.js bundle on every navigation.
|
2026-05-13 19:47:05 +00:00
|
|
|
location / {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
2026-05-19 20:17:47 +00:00
|
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
|
|
|
|
|
add_header Pragma "no-cache";
|
|
|
|
|
add_header Expires "0";
|
2026-05-13 19:47:05 +00:00
|
|
|
}
|
2026-05-13 14:08:11 +00:00
|
|
|
}
|