49 lines
1.5 KiB
Nginx Configuration File
Raw Normal View History

server {
listen 80;
server_name localhost;
resolver 127.0.0.11 valid=30s ipv6=off;
root /usr/share/nginx/html;
index index.html;
# Frontend SPA
location / {
try_files $uri $uri/ /index.html;
}
# Allow large file uploads (e.g. Excel imports up to 100MB)
client_max_body_size 100m;
# API proxy
location /api/ {
# Use Docker DNS dynamic resolution to avoid stale container IP after recreate.
set $gateway_upstream http://gateway:8888;
proxy_pass $gateway_upstream;
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;
}
# Upload files
location /uploads/ {
alias /usr/share/nginx/uploads/;
expires 30d;
add_header Cache-Control "public, immutable";
}
# Do not aggressively cache entry bundles because file names are stable
# (for example umi.js / umi.css) and stale cache can cause a blank page
# after deployment updates.
location ~* ^/(umi\.js|umi\.css|preload_helper\.js)$ {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Cache other static assets that are typically fingerprinted/chunked.
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}
}