WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP Super Cache] BUG: RewriteCond %{HTTP_COOKIE}.. (5 posts)

  1. jayant
    Member
    Posted 5 years ago #

    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.

  2. Donncha O Caoimh
    Member
    Posted 5 years ago #

    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.

  3. baptiste
    Member
    Posted 5 years ago #

    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_.*$

  4. Donncha O Caoimh
    Member
    Posted 5 years ago #

    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.

  5. baptiste
    Member
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic