Files
Skori/nginx.conf
T
Zed ce1db937f2
Build and Publish Docker Image / build-and-push-image (push) Successful in 1m48s
rework pwa cc
2026-07-11 02:01:08 +02:00

44 lines
1.4 KiB
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Proxy des appels API vers le backend (même origine => cookie httpOnly OK)
location /api/ {
proxy_pass http://backend:3001;
proxy_http_version 1.1;
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;
}
# Important pour les Single Page Applications (React Router)
location / {
try_files $uri $uri/ /index.html;
}
# Mise en cache agressive pour les assets statiques fingerprintés
location ~* \.(?:css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|webp|ico|pdf)$ {
expires 6M;
access_log off;
add_header Cache-Control "public, max-age=15552000, immutable";
}
# Jamais de cache sur les fichiers pilotant les mises à jour PWA
location = /index.html {
add_header Cache-Control "no-cache, must-revalidate";
}
location = /sw.js {
add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
}
location = /manifest.webmanifest {
add_header Cache-Control "no-cache, must-revalidate";
types { } default_type application/manifest+json;
}
location ~* ^/workbox-.*\.js$ {
add_header Cache-Control "public, max-age=15552000, immutable";
}
}