WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] vary cookie prevents browser caching (5 posts)

  1. ironmanjakarta
    Member
    Posted 4 years ago #

    I notice "vary: cookie" forces the browser to validate webpages every time. For instance, if you click on a link, go back and click the link again, the browser will do a 304, every time. Does the cookie parameter have to be emitted every time? I took it out and everything seems to be fine.

    Here they say you dont have to emit the cookie parameter except when using sessions: http://code.djangoproject.com/ticket/3586

  2. Frederick Townes
    Member
    Plugin Author

    Posted 4 years ago #

    Yes it does unfortunately because it's the cookie header that should also be considered here.

  3. rstaveley
    Member
    Posted 3 years ago #

    We are trying to stop Vary: Cookie from preventing caching. When you click around our site you get HTTP/200s where your prefer to have HTTP/304s (or better still have ETag/Expires cause there to be no request at all when there is a local copy).

    We have cookies on the domain for some social media stuff (Echo), but they ought not a reason to fresh content for the main pages. I suspect we can push them off into a directory in the domain to prevent them from appearing all the time.

    Is my understanding right, here, that if we can clean up our act and move our cookies into appropriate directories, the Vary: Cookie header will no longer prevent caching?

    Presumably, anyone who has logged into the site via /wp-admin/, although they may now be logged out, will have a root cookie and will therefore not be able cache? Can that be avoided?

  4. rstaveley
    Member
    Posted 3 years ago #

    I looked into the Echo code and they unfortunately have to put cookies into the root, because the Backplace JavaScript code uses them. That means we are stuck with Cookies.

    I don't see that Cookies have any relevance to the PHP in our site otherwise, so I'm going to have to hack W3TC to override the Vary: Cookie settings.

    Seems like don't vary Cookie would be a good config option to have. One for the wishlist, perhaps?

  5. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    Sure, noted.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic