mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-09-10 17:15:38 +00:00
48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
resolver 127.0.0.11 valid=10s ipv6=off;
|
|
|
|
# WebSocket upgrade — must come before the /api block
|
|
location /ws {
|
|
set $backend_upstream http://backend:3000;
|
|
proxy_pass $backend_upstream;
|
|
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_read_timeout 3600s;
|
|
}
|
|
|
|
# API and health check proxy to backend
|
|
location ~ ^/(api|healthz)(/|$) {
|
|
set $backend_upstream http://backend:3000;
|
|
proxy_pass $backend_upstream;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
|
|
# SPA fallback
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Cache immutable built assets aggressively.
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Always revalidate shell + service worker so deploys appear quickly.
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
}
|
|
location = /sw.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
}
|
|
}
|