keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

Minor Fixes #80

Closed vaska94 closed 4 years ago

vaska94 commented 4 years ago

Hi, as you know Facebook adds "fbclid" get parameter to all urls that cause cache to be bypassed, I thought it would be good idea to ignore "fbclid" parameter by default. also i have modified cache exclusion example which was incorrect!

svenba commented 4 years ago
  1. 8345a5c: While the example we currently have does produce duplicate group matches the suggested fix is not correct either. It should be the following instead: /^(wp-postpass|wordpress_logged_in|comment_author|woocommerce_items_in_cart|wp_woocommerce_session)_?/
  2. eeffac0: I see no issues with adding fbclid as a default GET attribute to have not bypass the cache since Facebook adds this to all outbound links from their platform.
vaska94 commented 4 years ago

@svenba, Hi Example cookie set by woocommerce is : wp_woocommerce_session_c1f2e998c64113d5c9eb8bce724113b9 woocommerce appends random hash to wp_woocommerce_session_. so you'r example is incorrect. ^(wp-postpass|wordpress_logged_in|comment_author|woocommerce_items_in_cart|wp_woocommerce_session_.*) is correct. image image

coreykn commented 4 years ago

Hi @vaska94,

The regular expression you’ve provided only covers a hash applied to wp_woocommerce_session_[hash]:

1

A hash is also applied to the following cookies:

woocommerce_items_in_cart doesn’t have a hash applied. WordPress and WooCommerce cookies information can be found in the following resources:

Our current approach matches the cookie name without the hash. Providing an exact match for the hash isn’t necessary because the preg_match() function in the cache_enabler.class.php file (L1351-L1363) will return true after the first match is found:

2

Feel free to submit a new pull request with the changes made.