You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We got a store with customers all over the world each customer has depending on his billing country different tax rates. So product prices are different if customers are signed in. Currently varnish always delivers the first cached version of a product page.
My first approach was to extend vcl_hash to include a custom cookie, which is set on customer login/logout. I've added following to the default.vcl
sub vcl_hash {
# default implementation
if (req.http.Cookie ~ "magento_country=") {
std.log("hash_data - country cookie: " + regsub(req.http.Cookie, "^.*?magento_country=([^;]*);*.*$", "\1"));
hash_data(regsub(req.http.Cookie, "^.*?magento_country=([^;]*);*.*$", "\1"));
} else {
std.log("no country cookie found, so we fallback to de");
hash_data("de");
}
std.log("vcl_hash end return lookup");
return (lookup);
}
Varnish still delivers first cached version instead of a different one based on the hash. vcl_log states, that the cookie is detected and added to the hash. Anyone an idea why I don't get another version?
The text was updated successfully, but these errors were encountered:
same issue. I tried a different approach, by bypassing cache based on cookie via pass/pipe on top of vcl_recv().
if (req.http.Cookie ~ "pricegroup=") { return (pipe); }
Yet, still the first version/price that was requested is delivered regardless of cookie being set. i also noticed, whenever I clean up the esi cache in admin, I get the correct first response.
Customer specific Product Prices
We got a store with customers all over the world each customer has depending on his billing country different tax rates. So product prices are different if customers are signed in. Currently varnish always delivers the first cached version of a product page.
My first approach was to extend
vcl_hash
to include a custom cookie, which is set on customer login/logout. I've added following to the default.vclVarnish still delivers first cached version instead of a different one based on the hash. vcl_log states, that the cookie is detected and added to the hash. Anyone an idea why I don't get another version?
The text was updated successfully, but these errors were encountered: