Files

48 lines
1.7 KiB
Nginx Configuration File

server {
listen 80;
root /usr/share/nginx/html;
index index.html;
# test build: always reload fresh files
add_header Cache-Control "no-cache";
# compressed downloads: the big files are packed once at build time (*.gz, see Dockerfile),
# the rest on the fly (the wasm goes from about 8.8 MB to 2.6 MB)
gzip_static on;
gzip on;
gzip_types application/wasm application/javascript text/css application/json application/manifest+json image/svg+xml;
gzip_min_length 1024;
gzip_vary on;
location / {
try_files $uri $uri/ =404;
}
# installable app (PWA)
location ~ \.webmanifest$ {
default_type application/manifest+json;
try_files $uri =404;
}
# the standalone file is public: it can be downloaded before login
location /standalone/ {
try_files $uri =404;
}
# savegame service (server/). Resolved at request time, so the game still starts without it;
# the game then falls back to savegame files.
# match relay WebSocket (server/src/netplay.rs)
location /api/netplay/ws {
resolver 127.0.0.11 valid=10s ipv6=off;
set $saves http://saves:8080;
proxy_pass $saves;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
location /api/ {
resolver 127.0.0.11 valid=10s ipv6=off;
set $saves http://saves:8080;
proxy_pass $saves;
client_max_body_size 33m; # campaigns up to 32 MB (server/src/main.rs MAX_CAMPAIGN)
proxy_read_timeout 15s;
}
}