Files
RustProxy/examples/vcl/cdn-technical-cookies.vcl
T
2026-11-20 23:14:19 +01:00

28 lines
1.2 KiB
Plaintext

// Optional template: only shared/public content independent of these cookies.
// Cloudflare: __cf_bm, cf_clearance, _cfuvid, __cfruid, __cfseq
// Akamai: _abck, ak_bmsc, bm_sz, bm_sv
// Security cookies can be needed for bot challenges; review before enabling.
sub vcl_recv {
if (req.method != "GET" && req.method != "HEAD") {
return(pass);
}
if (req.url ~ "^/(admin|api|auth|login|logout|panel|konto|dashboard)(/|[?]|$)") {
return(pass);
}
if (req.http.Authorization) {
return(pass);
}
// Match the complete Cookie header, not one cookie within it.
if (req.http.Cookie ~ "^(?:__cf_bm|cf_clearance|_cfuvid|__cfruid|__cfseq|_abck|ak_bmsc|bm_sz|bm_sv)=[^;]*(?:;[ \t]*(?:__cf_bm|cf_clearance|_cfuvid|__cfruid|__cfseq|_abck|ak_bmsc|bm_sz|bm_sv)=[^;]*)*$") {
unset req.http.Cookie;
}
// Remaining cookies: Cookie/session guard. RustProxy extension
// return(cookie_pass) bypasses pages like return(pass) but lets public
// static assets use the cache when "Ignore request cookies for static
// files" is on. In stock Varnish use return(pass) here.
if (req.http.Cookie) {
return(cookie_pass);
}
return(hash);
}