Files
InkNote/frontend/nginx.conf
T

65 lines
1.9 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Allow large drawing data + body size
client_max_body_size 50m;
# PWA service worker — MUST not be cached by browser/proxy
location = /sw.js {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Service-Worker-Allowed "/";
add_header Content-Type "application/javascript";
try_files $uri =404;
}
# PWA manifest
location = /manifest.json {
add_header Cache-Control "public, max-age=3600";
add_header Content-Type "application/manifest+json";
try_files $uri =404;
}
# Static assets — long cache with content hash from Vite
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# Icons
location ~* ^/icon-.*\.png$ {
add_header Cache-Control "public, max-age=86400";
try_files $uri =404;
}
# SPA fallback — all other routes serve index.html
location / {
try_files $uri $uri/ /index.html;
}
# API proxy
location /api/ {
proxy_pass http://inknote-server:4000;
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_connect_timeout 10;
proxy_send_timeout 60;
proxy_read_timeout 60;
}
# WebSocket proxy
location /ws {
proxy_pass http://inknote-server:4000;
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 86400;
}
}