Support » Plugins » [Plugin: WP Super Cache] BUG: RewriteCond %{HTTP_COOKIE}..

  • The plugin writes the line:-

    RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$

    Also, WordPress is creating a cookie:-

    Name	wordpress_test_cookie
    Value	WP+Cookie+check
    Host	MY_HOST_NAME_SNIPPED_INTENTIONALLY
    Path	/
    Secure	No
    Expires	At End Of Session

    When the user has only this cookie, because of the above line in .htaccess, the page skips the super cache and only uses the WP cache.

    I am not sure generally what all other cookie names are used by wordpress in order to write the new rule, but we surely need to exclude the above mentioned cookie.

Viewing 4 replies - 1 through 4 (of 4 total)
  • That’s not too much of a problem because it’s set only if someone tries to login. Presumably the user has a reason for logging in and they’ll succeed in which case they won’t see supercached pages anyway.

    Some plugins also set this cookie. It took me a while to finally realize my super cache was never being used. After the first hit on my site, users never use the super cache again.

    sidebarLogin widget is one such plugin.

    I worked around it by changing the test cookie in wp-config:
    define(‘TEST_COOKIE’, ‘wp_test_cookie’);

    and it fixed the problem (only in v2.3 or higher!!!), but it’s still sort of a hack. The new rewrite rules seem to be too broad. What was wrong with checking for the more specific cookies matches like

    RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
    RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
    RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$

    WP 2.5 and up don’t use the wordpressuser cookie any more so thats why it changed.

    I’ll update the README with a warning to change the test cookie if there are problems with caching.

    I’m not a mod_rewrite guru, but I’d think there would be some way to check for wordpress_ hash cookies that aren’t called wordpress_test_cookie. Would solve the problem for plugins and users hitting the login page. If I have some time I’ll try to play with some different rules.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Super Cache] BUG: RewriteCond %{HTTP_COOKIE}..’ is closed to new replies.