Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
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,
backend default { .host = "123.456.789.123"; .port = "80"; } backend admin { .host = "123.456.789.123"; .port = "80"; .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout = 600s; } sub vcl_recv { if (req.url ~ "^/admin") { set req.backend_hint = admin; } }
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.