Update deploy/varnish/default.vcl.template
This commit is contained in:
@@ -210,7 +210,7 @@ sub vcl_backend_response {
|
||||
}
|
||||
}
|
||||
|
||||
# (Opcjonalnie) Serwuj „stale” przy błędach backendu, jeśli jest obiekt w grace
|
||||
# (Opcjonalnie) Serwuj „stale" przy błędach backendu, jeśli jest obiekt w grace
|
||||
sub vcl_backend_error {
|
||||
return (deliver);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ sub vcl_deliver {
|
||||
if (obj.uncacheable) {
|
||||
if (req.http.X-Pass-Reason) {
|
||||
set resp.http.X-Cache = "PASS:" + req.http.X-Pass-Reason;
|
||||
} else if (resp.http.X-Pass-Reason) { # z backendu
|
||||
} else if (resp.http.X-Pass-Reason) {
|
||||
set resp.http.X-Cache = "PASS:" + resp.http.X-Pass-Reason;
|
||||
} else {
|
||||
set resp.http.X-Cache = "PASS";
|
||||
@@ -239,39 +239,14 @@ sub vcl_deliver {
|
||||
unset resp.http.Server;
|
||||
}
|
||||
|
||||
# ===== SYNTH - ulepszony z HTML dla 429 =====
|
||||
# ===== SYNTH - naprawiony składniowo =====
|
||||
sub vcl_synth {
|
||||
unset resp.http.X-Varnish;
|
||||
|
||||
# 429 Too Many Requests - HTML szablon
|
||||
|
||||
# 429 Too Many Requests - HTML szablon (jedna długa linia)
|
||||
if (resp.status == 429) {
|
||||
set resp.http.Content-Type = "text/html; charset=utf-8";
|
||||
synthetic({
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>429 - Zbyt wiele żądań</title>
|
||||
<style>
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 0; padding: 40px; background: #f8f9fa; color: #333; text-align: center; }
|
||||
.container { max-width: 500px; margin: 0 auto; background: white; padding: 60px 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
|
||||
h1 { font-size: 72px; font-weight: 300; margin: 0 0 20px; color: #dc3545; }
|
||||
h2 { font-size: 24px; font-weight: 400; margin: 0 0 30px; color: #495057; }
|
||||
p { font-size: 16px; line-height: 1.6; margin: 0 0 20px; color: #6c757d; }
|
||||
.retry { background: #007bff; color: white; padding: 12px 30px; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; text-decoration: none; display: inline-block; }
|
||||
.retry:hover { background: #0056b3; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>429</h1>
|
||||
<h2>Zbyt wiele żądań</h2>
|
||||
<p>Przekroczyłeś limit żądań. Spróbuj ponownie za chwilę.</p>
|
||||
<p><strong>Limit:</strong> 200 żądań / 10 sekund</p>
|
||||
<a href="javascript:location.reload()" class="retry">Spróbuj ponownie</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
});
|
||||
synthetic({"<!DOCTYPE html><html><head><title>429 - Zbyt wiele żądań</title><style>body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;margin:0;padding:40px;background:#f8f9fa;color:#333;text-align:center;}.container{max-width:500px;margin:0 auto;background:white;padding:60px 40px;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,0.1);}.h1{font-size:72px;font-weight:300;margin:0 0 20px;color:#dc3545;}.h2{font-size:24px;font-weight:400;margin:0 0 30px;color:#495057;}p{font-size:16px;line-height:1.6;margin:0 0 20px;color:#6c757d;}.retry{background:#007bff;color:white;padding:12px 30px;border:none;border-radius:6px;font-size:16px;cursor:pointer;text-decoration:none;display:inline-block;}.retry:hover{background:#0056b3;}</style></head><body><div class=\"container\"><h1 class=\"h1\">429</h1><h2 class=\"h2\">Zbyt wiele żądań</h2><p>Przekroczyłeś limit żądań. Spróbuj ponownie za chwilę.</p><p><strong>Limit:</strong> 200 żądań / 10 sekund</p><a href=\"javascript:location.reload()\" class=\"retry\">Spróbuj ponownie</a></div></body></html>"});
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user