diff --git a/deploy/varnish/default.vcl.template b/deploy/varnish/default.vcl.template index 3d69823..4df995f 100644 --- a/deploy/varnish/default.vcl.template +++ b/deploy/varnish/default.vcl.template @@ -65,7 +65,7 @@ sub vcl_recv { # } # ---- STATYCZNE – agresywny cache + ignorujemy sesję ---- - if (req.url ~ "^/static/" || req.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)$") { + if (req.url ~ "^/static/" || req.url ~ "^/uploads/" || req.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)$") { unset req.http.Cookie; unset req.http.Authorization; return (hash); @@ -141,8 +141,7 @@ sub vcl_backend_response { } # Nie cache'uj statyków, jeśli status ≠ 200 - if (bereq.url ~ "^/static/" || - bereq.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)($|\?)") { + if (bereq.url ~ "^/static/" || req.url ~ "^/uploads/" || bereq.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)($|\?)") { if (beresp.status != 200) { set beresp.uncacheable = true; set beresp.ttl = 0s; @@ -170,7 +169,7 @@ sub vcl_backend_response { } # ---- STATYCZNE: zdejmij Set-Cookie i Vary: Cookie, zapewnij TTL ---- - if (bereq.url ~ "^/static/" || bereq.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)$") { + if (bereq.url ~ "^/static/" || req.url ~ "^/uploads/" || bereq.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)$") { unset beresp.http.Set-Cookie; # Jeśli backend dodał Vary: Cookie, usuńmy ten element (nie wpływa na statyki)