• On my virtual host to cache page is used varnish but is not customizable. I need to prevent cache on this page or this request modifying the Ajax call to set the ‘Cache-Control’ header to ensure that the call is not cached by Varnish.

    This is the page/ajax req(this is the varnish conf):

    if (req.url ~ “^/(cart|my-account|checkout|addons)”) {
    return (pass);
    }

    if ( req.url ~ “\?add-to-cart=” ) {
    return (pass);
    }

    I doesn’t understand if i can do it with your plugin.

Viewing 1 replies (of 1 total)
  • This plugin does take in account pages specific to woocommerce and sends no-cache accordingly.

    I didn’t check if this was the case for ajax calls :-/

    if you use apache you could always tweak this via .htaccess rules

    RewriteCond %{REQUEST_URI} (^|/)(cart|my-account|checkout|addons) [OR]
    RewriteCond %{QUERY_STRING} add-to-cart=
    RewriteRule .* – [ENV=DONTCACHE:true,L]

    Header set Cache-Control “no-cache, no-store, must-revalidate” env=DONTCACHE

    note that RewriteCond %{REQUEST_URI} receives with leading slash or not depending of your setup

Viewing 1 replies (of 1 total)
  • The topic ‘Setting ‘Cache-Control’ header versus Varnish’ is closed to new replies.