这是我的主网站页面的清漆日志 https://pastebin.com/RxsPKe7z
这是我的* vcl上的哈希事项,它显示了一个很好的命中,但为什么我得到哈希返回?
- 我还有其他页面也为客人设置了WordPress登录的cookie,我会在另一个问题上分享它
vcl recive
if (req.url ~ "^[^?]*\.(7z|avi|bz2|flac|flv|gz|mka|mkv|mov|mp3|mp4|mpeg|mpg|ogg|ogm|opus|rar|tar|tgz|tbz|txz|wav|webm|xz|zip)(\?.*)?$") {
unset req.http.Cookie;
return (hash); }
if (req.url ~ "^[^?]*\.(7z|avi|bmp|bz2|css|csv|doc|docx|eot|flac|flv|gif|gz|ico|jpeg|jpg|js|less|mka|mkv|mov|mp3|mp4|mpeg|mpg|odt|otf|ogg|ogm|opus|pdf|png|ppt|pptx|rar|rtf|svg|svgz|swf|tar|tbz|tgz|ttf|txt|txz|wav|webm|webp|woff|woff2|xls|xlsx|xml|xz|zip)(\?.*)?$") {
unset req.http.Cookie;
return (hash);
}
sub vcl_hash {
# Called after vcl_recv to create a hash value for the request.
This is used as a key
# to look up the object in Varnish.
hash_data(req.url);
if (req.http.host) {
hash_data(req.http.host);
} else {
hash_data(server.ip);
}
#https://docs.woocommerce.com/document/woocommerce-cookies/
if (req.http.cookie ~ "woocommerce_items_in_cart") {
set req.http.X-TMP2 = regsub(req.http.cookie, ".*woocommerce_items_in_cart([^;]+);.*", "\1");
hash_data(req.http.X-TMP2);
unset req.http.X-TMP2;}
if (req.http.cookie ~ "woocommerce_cart_hash") {
set req.http.X-TMP3 = regsub(req.http.cookie, ".*woocommerce_cart([^;]+);.*", "\1");
hash_data(req.http.X-TMP3);
unset req.http.X-TMP3;}
if (req.http.cookie ~ "woocommerce_session_") {
set req.http.X-TMP4 = regsub(req.http.cookie, ".*woocommerce_session([^;]+);.*", "\1");
hash_data(req.http.X-TMP4);
unset req.http.X-TMP4;
}
return (lookup);
}
我想确保我走在正确的轨道上
最好的。