diff --git a/deploy/varnish/default.vcl.template b/deploy/varnish/default.vcl.template index dbae70e..220eedd 100644 --- a/deploy/varnish/default.vcl.template +++ b/deploy/varnish/default.vcl.template @@ -55,15 +55,6 @@ sub vcl_recv { } } - # ---- (Opcjonalnie) Normalizacja Accept dla obrazów generowanych wariantowo ---- - # if (req.url ~ "\.(png|jpe?g|gif|bmp)$") { - # if (req.http.Accept ~ "image/webp") { - # set req.http.X-Accept-Image = "modern"; # webp - # } else { - # set req.http.X-Accept-Image = "legacy"; # jpg/png - # } - # } - # ---- STATYCZNE – agresywny cache + ignorujemy sesję ---- if (req.url ~ "^/static/" || req.url ~ "\.(css|js|png|jpe?g|webp|svg|ico|woff2?)$") { unset req.http.Cookie; @@ -90,12 +81,6 @@ sub vcl_recv { return (pass); } - # jeśli chcesz PASS przy cookie: - # if (req.http.Cookie) { - # set req.http.X-Pass-Reason = "cookie"; - # return (pass); - # } - return (hash); } @@ -254,7 +239,56 @@ sub vcl_deliver { unset resp.http.Server; } +# ===== SYNTH - ulepszony z HTML dla 429 ===== sub vcl_synth { + unset resp.http.X-Varnish; + + # 429 Too Many Requests - HTML szablon + if (resp.status == 429) { + set resp.http.Content-Type = "text/html; charset=utf-8"; + synthetic({ + + +
+Przekroczyłeś limit żądań. Spróbuj ponownie za chwilę.
+Limit: 200 żądań / 10 sekund
+ Spróbuj ponownie +