Support » Plugin: W3 Total Cache » [Plugin: W3 Total Cache] vary cookie prevents browser caching

  • Resolved ironmanjakarta


    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:

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Frederick Townes


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

    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?

    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?

    Plugin Author Frederick Townes


    Sure, noted.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: W3 Total Cache] vary cookie prevents browser caching’ is closed to new replies.