This commit is contained in:
+14
-6
@@ -5,21 +5,29 @@ server {
|
||||
index index.html;
|
||||
|
||||
# Important pour les Single Page Applications (React Router)
|
||||
# Si le fichier n'existe pas, on redirige vers index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Mise en cache agressive pour les assets statiques
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|webp)$ {
|
||||
# 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";
|
||||
}
|
||||
|
||||
# Ne pas mettre en cache le service worker pour que la PWA se mette à jour
|
||||
# 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 {
|
||||
expires -1;
|
||||
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user