fix: avoid caching edge auth responses
Homelab Main / validate (push) Successful in 18s Details
Homelab Main / running-update (push) Successful in 8s Details
Homelab Main / debian-ops (push) Successful in 1m17s Details

This commit is contained in:
juvenal.diaz 2026-09-29 15:08:16 -06:00
parent 5cdc696290
commit cd5b493496
1 changed files with 26 additions and 0 deletions

View File

@ -10,6 +10,14 @@ sub vcl_recv {
return (pass);
}
if (req.http.Authorization || req.http.Cookie) {
return (pass);
}
if (req.url ~ "^/(login|logout|api/login|login/generic_oauth)($|[?])") {
return (pass);
}
if (req.method != "GET" && req.method != "HEAD") {
return (pass);
}
@ -18,6 +26,24 @@ sub vcl_recv {
}
sub vcl_backend_response {
if (beresp.status != 200) {
set beresp.uncacheable = true;
set beresp.ttl = 120s;
return (deliver);
}
if (beresp.http.Set-Cookie) {
set beresp.uncacheable = true;
set beresp.ttl = 120s;
return (deliver);
}
if (beresp.http.Cache-Control ~ "(?i)(private|no-cache|no-store)") {
set beresp.uncacheable = true;
set beresp.ttl = 120s;
return (deliver);
}
set beresp.ttl = 1h;
}