清漆 – 允许特定的后端cookie?

我想弄清楚如何让后端在特定的注册页面上查看跟踪cookie,但忽略其他人。 目前,我试图使用从后端发送的自定义标头来set beresp.ttl = 0s;vcl_fetch里面:

if (beresp.http.cache-control ~ "max-age=-30") { set beresp.ttl = 0s; }

但是注册页面仍然阻止后端读取cookie。

vcl_recv我使用这个方法删除它们:

set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[az]+|_ga|_mkto_trk)=[^;]*", "");

set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");

if (req.http.Cookie ~ "^\s*$") { unset req.http.Cookie; }

我怎样才能允许cookie在这些特定页面的后端读取? 我假设我需要在vcl_recv创buildexception?

是的 – 你需要“回来(小姐);” 在后端请求。 vcl_fetch仅在从后端“获取”某个项目时触发 – 如果项目已经存储在caching中,varnish将不会运行提取代码。