如果你想重命名我認爲這將是這樣的:
sub vcl_fetch {
#renamed after receiving the backend
set beresp.http.set-cookie = regsuball(beresp.http.set-cookie, "bad_cookie", "good_cookie");
set beresp.http.cookie = regsuball(beresp.http.cookie, "bad_cookie", "good_cookie"); }
}
sub vcl_deliver {
#renamed before sending the client
set resp.http.set-cookie = regsuball(beresp.http.set-cookie, "bad_cookie", "good_cookie");
set resp.http.cookie = regsuball(beresp.http.cookie, "bad_cookie", "good_cookie"); }
}
如果你想刪除所有餅乾:
sub vcl_fetch {
#deleted after receiving the backend
remove beresp.http.set-cookie;
remove beresp.http.cookie;
}
sub vcl_deliver {
#deleted before sending the client
remove resp.http.set-cookie;
remove resp.http.cookie;
}
beresp.http.set-cookie
只讀取第一套-Cookie header,如果你想刪除一些並保留其他人可以使用:github.com/varnish/libvmod-header **
在vcl_fetch中刪除beresp.http.set-cookie將刪除所有cookie。它看起來像你不能刪除一些響應cookies並保留其他人,因爲刪除beresp.http.set-cookie只讀取第一個Set-Cookie頭。仍然沒有找到解決方案 –
你是對的,因爲多個set-cookie頭文件可以使用:https://github.com/varnish/libvmod-header – matiasrege
是啊,vmod_header正是我所需要的......謝謝。 –