Varnish (https://www.varnish-cache.org/) konfigurācija, kas kešo statiskos failus (bildes, js, css, txt) bet nekešo skriptus, kā arī pievieno headeri lai redzētu, vai konkrētais pieprasījums nāk no cache, vai webservera (HIT/MISS).

default.vcl

#
# varnish config
# caches all static files (images, js, css, txt, flash)
# but requests from backend dinamic content
#

# webserver
backend default {
   .host = "127.0.0.1";
   .port = "8080";
}

# what files to cache
sub vcl_recv {
   if (req.url ~ "\.(png|gif|jpg|ico|txt|swf|css|js)$") {
      return(lookup);
   }
}

# strip the cookie before the image is inserted into cache
sub vcl_fetch {
   if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
      unset beresp.http.set-cookie;
   }
}

# add response header to see if document was cached
sub vcl_deliver {
   if (obj.hits > 0) {
      set resp.http.X-Cache = "HIT";
   } else {
      set resp.http.X-Cache = "MISS";
   }
}

Laboja mad, labots 6x