Varnish: Debrief

Today, we just released the Varnish-ed site I posted about a few days ago. A few things to be careful about in your Varnish deployment (that I had originally overlooked): Make sure you’re 301 redirecting traffic to your canonical name (http://www.example.com/example to http://example.com/example, or vice versa) Do this redirecting within Varnish! I had strange problems when applying this logic within Apache. If you insist on applying the redirection logic within Apache, you may run into a problem where the Varnish health-check “probes” will fail (and deem your backend “sick”, throwing 503 errors at everyone after the grace period has expired).

Read more

Varnish on a Dynamic Site

TL;DR: Scroll to the bottom for the attached VCL. No, I’m not talking about the stuff you put on paint to make it last longer. I’m talking about this amazing piece of software: https://www.varnish-cache.org/ Put simply, Varnish is a “reverse proxy” - a piece of software that goes between the main server and the client. Basically what it does is caches content, so PHP (or whatever backend you’re using) doesn’t need to run for every single request - this makes perfect sense with static content.

Read more