From b48d47c5ee40600012636d863932f1c327d8a8d7 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 21 May 2025 16:38:26 +0200 Subject: [PATCH] try with included in frontend location block --- .../sites-available/gradido.conf.ssl.template | 27 ++++++++++--------- .../sites-available/gradido.conf.template | 25 +++++++++-------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 425abd69a..c2fe889b8 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -52,24 +52,27 @@ server { rewrite ^/vue/?(.*)$ /$1 permanent; } - # caching rules for assets - # static assets - location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ { - # keep assets for a week - add_header Cache-Control "public, max-age=604800"; - } - # hashed assets - location ~* \.(?:js|css|json)$ { - add_header Cache-Control "public, max-age=31536000, immutable"; - } - # Frontend (default) location / { limit_req zone=frontend burst=150 nodelay; limit_conn addr 60; root $PROJECT_ROOT/frontend/build/; index index.html; - try_files $uri $uri/ /index.html = 404; + + # caching rules for assets + # static assets + location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ { + # keep assets for a week + add_header Cache-Control "public, max-age=604800"; + try_files $uri =404; + } + # hashed assets + location ~* \.(?:js|css|json)$ { + add_header Cache-Control "public, max-age=31536000, immutable"; + try_files $uri =404; + } + + try_files $uri $uri/ /index.html = 404; # don't cache index.html add_header Cache-Control "no-cache, no-store, must-revalidate"; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 1e46318ee..05d5719dd 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -37,23 +37,26 @@ server { rewrite ^/vue/?(.*)$ /$1 permanent; } - # caching rules for assets - # static assets - location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ { - # keep assets for a week - add_header Cache-Control "public, max-age=604800"; - } - # hashed assets - location ~* \.(?:js|css|json)$ { - add_header Cache-Control "public, max-age=31536000, immutable"; - } - # Frontend (default) location / { limit_req zone=frontend burst=150 nodelay; limit_conn addr 60; root $PROJECT_ROOT/frontend/build/; index index.html; + + # caching rules for assets + # static assets + location ~* \.(?:woff2?|ttf|otf|eot|jpg|jpeg|png|gif|svg|webp|ico)$ { + # keep assets for a week + add_header Cache-Control "public, max-age=604800"; + try_files $uri =404; + } + # hashed assets + location ~* \.(?:js|css|json)$ { + add_header Cache-Control "public, max-age=31536000, immutable"; + try_files $uri =404; + } + try_files $uri $uri/ /index.html = 404; # don't cache index.html