2026-05-05 23:01:25 +08:00
|
|
|
set_real_ip_from 127.0.0.1;
|
|
|
|
|
set_real_ip_from 10.42.0.0/16;
|
|
|
|
|
set_real_ip_from 10.43.0.0/16;
|
|
|
|
|
set_real_ip_from 172.16.0.0/12;
|
|
|
|
|
real_ip_header X-Forwarded-For;
|
|
|
|
|
real_ip_recursive on;
|
|
|
|
|
|
2026-05-01 18:20:13 +08:00
|
|
|
map $http_upgrade $connection_upgrade {
|
|
|
|
|
default upgrade;
|
|
|
|
|
'' close;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 21:27:15 +08:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# SPA fallback — all non-file requests go to index.html
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-14 13:12:42 +08:00
|
|
|
# Never cache the SPA entrypoint — chunk hashes change every deploy and a
|
|
|
|
|
# stale index.html keeps users stuck on 404'd chunks even after reload.
|
|
|
|
|
location = /index.html {
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
|
|
|
|
expires -1;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 21:27:15 +08:00
|
|
|
# Proxy API requests to the backend
|
|
|
|
|
location /api {
|
|
|
|
|
proxy_pass http://tenant-api:8080;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2026-05-05 23:01:25 +08:00
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
2026-04-15 21:27:15 +08:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2026-05-01 18:20:13 +08:00
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection $connection_upgrade;
|
2026-04-15 21:27:15 +08:00
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
proxy_send_timeout 300s;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-30 23:19:31 +08:00
|
|
|
# Proxy Swagger UI and OpenAPI JSON to the backend for API testing
|
|
|
|
|
location ^~ /swagger {
|
|
|
|
|
proxy_pass http://tenant-api:8080;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2026-05-05 23:01:25 +08:00
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
2026-04-30 23:19:31 +08:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2026-05-01 18:20:13 +08:00
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection $connection_upgrade;
|
2026-04-30 23:19:31 +08:00
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
proxy_send_timeout 300s;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 21:27:15 +08:00
|
|
|
# Cache static assets aggressively
|
|
|
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
|
|
|
|
expires 1y;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gzip on;
|
2026-05-01 01:12:13 +08:00
|
|
|
gzip_static on;
|
|
|
|
|
gzip_vary on;
|
2026-04-15 21:27:15 +08:00
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml;
|
2026-05-01 01:12:13 +08:00
|
|
|
|
|
|
|
|
brotli_static on;
|
2026-04-15 21:27:15 +08:00
|
|
|
}
|