From bcc56d6dd23746ff3cbd4f908865c100a08c21c0 Mon Sep 17 00:00:00 2001 From: bartool Date: Wed, 29 Oct 2025 19:38:32 +0100 Subject: [PATCH] refactor: update nginx configuration for improved caching and clarity --- frontend/nginx.conf | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/nginx.conf b/frontend/nginx.conf index ff81f91..1f88b6b 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -1,19 +1,33 @@ server { listen 80; - # Przekieruj /odoo (bez slash) na /odoo/ (z slash) + # Przekierowanie bez / na /odoo/ location = /odoo { return 301 /odoo/; } - # Serwowanie plików Vue pod /odoo/ + # Serwowanie Vue location /odoo/ { alias /usr/share/nginx/html/; index index.html; try_files $uri $uri/ /odoo/index.html; } - # Proxy do backendu (niewidoczny z zewnątrz) + # no cache index.html + location = /odoo/index.html { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + expires 0; + } + + # cache JS/CSS/OBRAZY na długo + location ~* \.(?:js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { + add_header Cache-Control "public, max-age=31536000, immutable"; + access_log off; + expires 1y; + alias /usr/share/nginx/html/; + } + + # Proxy do backendu location /odoo/api/ { proxy_pass http://backend:8000/; proxy_set_header Host $host; @@ -22,3 +36,4 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } } +