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
Is it possible that cookie groups do not actually support the use of regex?
Under Settings -> Cache Groups in the section manage cookie groups under the Cookies textarea field it is stated that regex are supported:
Specify the cookies for this group. Values like 'cookie', 'cookie=value', and cookie[a-z]+=value[a-z]+ are supported. Remember to escape special characters like spaces, dots or dashes with a backslash. Regular expressions are also supported.
However, when using a regex it appears that meta characters are escaped while generating mod_rewrite rewrite conditions, see:
In the rule generated all the metacharacters have been escaped. In consequence the condition does not match a request with cookie_1_prefs=a1. See following trace:
Also worth noting is that the escaping does not only affect the rewrite conditions and thus delivery of cached files but also cache generation itself. The same method for escaping metacharacters in the cookies is used when assembling the suffix for the cache files, see
So in case a regex is used to specify the cookie for a cookie group the group will not be detected when assembling the cache path and thus the content for the accessed URL will be cached as default (no group).
Is it possible that cookie groups do not actually support the use of regex?
Under Settings -> Cache Groups in the section manage cookie groups under the Cookies textarea field it is stated that regex are supported:
However, when using a regex it appears that meta characters are escaped while generating mod_rewrite rewrite conditions, see:
w3-total-cache/PgCache_Environment.php
Line 657 in 91e0b97
To examplify this issue I created a cache group regtest1 with the following settings:
cookie_.*_prefs=a.*
In return the following rewrite rule/condition was added to my .htaccess file by W3 Total Cache:
In the rule generated all the metacharacters have been escaped. In consequence the condition does not match a request with cookie_1_prefs=a1. See following trace:
When manually adding the same condition without escaping of metacharacters the condition matches.
This issue does not only affect user defined cache groups but also applies to the built in cache group for logged in users, see
w3-total-cache/ConfigKeys.php
Line 720 in 91e0b97
To match this group the following two lines are added to
.htaccess
But a request with the cookie
wordpress_logged_in_1234
will not be matched by this conditionEnvironment
The text was updated successfully, but these errors were encountered: