do not cache static files on admin domain
do not cache static files on admin domain

--- a/varnish-conf/v3/lib/static.vcl
+++ b/varnish-conf/v3/lib/static.vcl
@@ -2,6 +2,11 @@
 
 sub vcl_recv {
     if (req.request ~ "^(GET|HEAD)$" && req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)(\?.*)?$") {
+        # if you use a subdomain for admin section, do not cache it
+        #if (req.http.host ~ "admin.yourdomain.com") {
+        #    set req.http.X-VC-Cacheable = "NO:Admin domain";
+        #    return(pass);
+        #}
         # enable this if you want
         #if (req.url ~ "debug") {
         #    set req.http.X-VC-Debug = "true";

--- a/varnish-conf/v4/lib/static.vcl
+++ b/varnish-conf/v4/lib/static.vcl
@@ -2,6 +2,11 @@
 
 sub vcl_recv {
     if (req.method ~ "^(GET|HEAD)$" && req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)(\?.*)?$") {
+        # if you use a subdomain for admin section, do not cache it
+        #if (req.http.host ~ "admin.yourdomain.com") {
+        #    set req.http.X-VC-Cacheable = "NO:Admin domain";
+        #    return(pass);
+        #}
         # enable this if you want
         #if (req.url ~ "debug") {
         #    set req.http.X-VC-Debug = "true";

--- a/vcaching.php
+++ b/vcaching.php
@@ -357,7 +357,7 @@
                 }
             } else {
                 $this->noticeMessage .= '<br />' . __('Trying to purge URL :', $this->plugin) . $purgeme;
-                $message = preg_match("/<title>(.*)<\/title>/i", $response['body'], $matches);
+                preg_match("/<title>(.*)<\/title>/i", $response['body'], $matches);
                 $this->noticeMessage .= ' => <br /> ' . isset($matches[1]) ? " => " . $matches[1] : $response['body'];
                 $this->noticeMessage .= '<br />';
                 if ($this->debug) {

comments