Skip to content

Commit 3ff60db

Browse files
authored
modify cache exclusion rules for WordPress and WooCommerce
1 parent 3d577ac commit 3ff60db

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

nginx/nginx.conf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ http {
143143
}
144144

145145
# 3. Cookie-based exclusions
146-
# Skips cache for logged-in users and active WooCommerce sessions. Products always cached.
146+
# Skips cache for Wordpress.
147147
map $http_cookie $skip_cache_cookie {
148148
default 0;
149-
~*(comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart) 1;
149+
~*(comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in) 1;
150+
}
151+
152+
# Skips cache for WooCommerce.
153+
map $cookie_woocommerce_items_in_cart $skip_cache_cart {
154+
default 0;
155+
"1" 1;
150156
}
151157

152158
# 4. AJAX-based exclusions

0 commit comments

Comments
 (0)