Multi-stage Dockerfile: node:22-alpine builder + nginx:alpine server. nginx.conf sets COOP/COEP headers (required for SharedArrayBuffer/audio workers), SPA fallback, and aggressive caching for content-hashed assets. API credentials and BASE_URL passed as build args.
34 lines
941 B
Nginx Configuration File
34 lines
941 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# WASM needs correct MIME type
|
|
types {
|
|
application/wasm wasm;
|
|
}
|
|
|
|
# SharedArrayBuffer requires these headers (used by audio/video workers)
|
|
add_header Cross-Origin-Opener-Policy "same-origin";
|
|
add_header Cross-Origin-Embedder-Policy "require-corp";
|
|
|
|
# SPA fallback
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Cache static assets aggressively (content-hashed filenames)
|
|
location ~* \.(js|css|wasm|woff2|woff|ttf|png|jpg|webp|svg|ico)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
add_header Cross-Origin-Opener-Policy "same-origin";
|
|
add_header Cross-Origin-Embedder-Policy "require-corp";
|
|
}
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/javascript application/json application/wasm;
|
|
gzip_min_length 1024;
|
|
}
|