• I am using external auth+forum for comments, hence the users are not logged into WP.

    Is there a way to never serve cached pages for users with a certain cookie set? (Similar to rejected user agents?)
    Those visitors without the cookie should still receive the cached pages.

    Thanks in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter PeterB

    (@peter_bepe)

    I know it can be done by adding

    if(isset($_COOKIE['mycookiename'])){
            return;
    }

    to the page-cache.php somewhere near the top, but I’d rather have some more upgrade-proof solution 🙂

    Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @peter_bepe,

    Actually, you can specify particular cookies from the “Advanced Options” tab – https://cloudup.com/cNo93cNcrf2

    Please give it a try and let us know 🙂

    Cheers,

    Thread Starter PeterB

    (@peter_bepe)

    That was my first try, but even with the cookie, I got served with cached pages.

    Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @peter_bepe,

    Sorry for the delay here, it seems a bug with that functionality. We will check that out.

    Thanks for reporting,

    Thread Starter PeterB

    (@peter_bepe)

    Thank you, will happily test the fixed version 🙂

    Thread Starter PeterB

    (@peter_bepe)

    Do you happen to need any help with the testing?

    Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @peter_bepe,

    I’ve checked this and couldn’t reproduce the issue with a cookie name like TestCookie What is the cookie name that you want to reject?

    There might be an issue with the cookie names that using + (eg. You have to reject Test_Cookie for Test+Cookie)

    Thread Starter PeterB

    (@peter_bepe)

    Thanks for checking it.
    My cookie name is test_member_hash_loggedin.
    Can the object cache responsible for serving the cached pages while the cookie is present?

    Plugin Author Mustafa Uysal

    (@m_uysl)

    That’s weird. I just checked test_member_hash_loggedin and it works as expected.

    > Can the object cache responsible for serving the cached pages while the cookie is present?

    Nope, I don’t think so!

    Could you check the configuration file located in wp-content/pc-config (https://cloudup.com/cFXTVULDM-w) and make sure rejected_cookies specified there

    Plugin Author Mustafa Uysal

    (@m_uysl)

    @peter_bepe

    I think the problem is the webserver configuration. If you have apache/Nginx configurations to serving cached files without PHP execution, that might lead the problem here.

    Apache:

    RewriteCond %{HTTP:Cookie} !(wordpressuser_|wordpresspass_|wordpress_sec_|wordpress_logged_in_|test_member_hash_loggedin) [NC]

    Nginx:

    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in|powered_cache_commented_posts| test_member_hash_loggedin") {

    I just opened a new issue on GitHub about this – https://github.com/skopco/powered-cache/issues/57

    Thread Starter PeterB

    (@peter_bepe)

    Hi Mustafa,
    Thanks, I think the .htaccess line was the culprit, since the pc-config file had the rejected cookie value.

    I am still testing it, but I think the cookie name was not added automatically by the PoweredCache .htaccess builder function.

    Will report back once it is fully tested.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Never send cached pages when using specific cookie’ is closed to new replies.