main.bundle.js and the CSS keep the same name in every version, and nginx didn't send Cache-Control, so browsers could keep running the old bundle after a deploy. Then new pages (like /research/tree) showed the landing page, stuck on "Loading servers…". Send Cache-Control: no-cache, so browsers revalidate each load; unchanged files are still a cheap 304 via the ETag. Icons keep their 1 day expiry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.5 KiB
Nginx Configuration File
51 lines
1.5 KiB
Nginx Configuration File
events {}
|
|
|
|
http {
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Sets the path, format, and configuration for a buffered log write
|
|
#log_format compression '$remote_addr - $remote_user [$time_local] '
|
|
#'"$request" $status $upstream_addr '
|
|
#'"$http_referer" "$http_user_agent"';
|
|
|
|
server {
|
|
listen 80;
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
index index.html;
|
|
|
|
# Docker's internal DNS - resolve the backend lazily, so nginx can start before it
|
|
resolver 127.0.0.11 valid=10s;
|
|
|
|
# building icons, exported from Factorio (see docs/kafkatorio-platform/building-icons)
|
|
location /kafkatorio/icons/ {
|
|
alias /usr/share/nginx/icons/;
|
|
expires 1d;
|
|
}
|
|
|
|
# proxy REST + WebSocket requests to events-server-web, so the map and the API share an origin
|
|
location /kafkatorio/ {
|
|
set $events_server_web http://events-server-web:80;
|
|
proxy_pass $events_server_web;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_read_timeout 1h;
|
|
}
|
|
|
|
location / {
|
|
# First attempt to serve request as file, then
|
|
# as directory, then fall back to redirecting to index.html
|
|
try_files $uri $uri/ $uri.html /index.html;
|
|
|
|
include mime.types;
|
|
|
|
# main.bundle.js and the CSS keep the same name in every version, so make browsers check
|
|
# for a new version on every load (unchanged files get a cheap 304, via the ETag)
|
|
add_header Cache-Control "no-cache" always;
|
|
}
|
|
}
|
|
}
|