503 Guru Meditation Error / Backend Unavailable – Varnish

503 Guru Meditation Error / Backend Unavailable ugh. This error is the worst, it could mean so many things. Luckily in our case, we were getting this error when we tried to upload a large file. Bypassing Varnish and uploading the file to Apache directly worked fine which meant both Apache and PHP configs were fine, didn’t require tweaking and that this was a Varnish timeout.

Upon Googling, we discovered that the default timeout for Varnish for backends is 60s, we needed to increase this, but here another problem arose. We didn’t want to increase the timeout for the whole site, just the admin section. Below is how we got to do just this.

Edit your VCL file at /etc/varnish and make the following changes,

So we ended up creating two backends, labeling the second as admin and increased the timeouts for it, then running a check for admin in the url and passing that request to the admin labeled backend.