Cloudways’ Varnish cache is sometimes a little too “sticky” for hers, especially under the Woocommerce environment without the correct exclusions. Most of us who are using Cloudways as our hosting service (CPG Cloudways Guide) will certainly come across a handful of annoying issues that could turn a sale away; such as the top right icon cart count doesn’t update when adding or removing an item, persistent empty cart, users unable to login or check out, shipping cost does not calculate, etc…
To fix those problems, carefully apply these rules for your Varnish cache from Cloudways platform panel. Be sure you already have Varnish enabled and properly configured for WordPress (Varnish setting for W3TC).
1. Exclusion Rules for Woocommerce
Type |
Method |
Value |
URL | Exclude | \?add-to-cart= |
URL | Exclude | ^/(cart|my-account/*|checkout|wc-api/*|addons|logout|lost-password|product/*|wp-admin|wp-login) |
Cookie | Exclude | woocommerce_cart_hash |
Cookie | Exclude | woocommerce_items_in_cart |
Cookie | Exclude | wp_woocommerce_session_ |
Sample:
2. Optional Rules for WordPress
Type |
Method |
Value |
Cookie | Exclude | wp-settings-\d+=[^;]+(; )? |
Cookie | Exclude | wp-settings-time-\d+=[^;]+(; )? |
Cookie | Exclude | wordpress_test_cookie=[^;]+(; )? |
Cookie | Exclude | wordpress_logged_in |
For add to cart, is it supposed to be a forward slash or backward slash before the question mark?
Backward slash, as used in Cloudways server directory path.