Increase varnish timeout for a specific path

varnish

I have a set of scripts on the /admin path that can take a while to execute, and cause Varnish to hit the timeout limit. Is there a way to increase the timeouts for a particular path rather than for an entire backend?

Best Answer

You may try to add one more backend with same host, but different timeouts

And use it for your urls with req.backend

backend default {
.host = "127.0.0.1";
.port = "81";
}

backend admin {
.host = "127.0.0.1";
.port = "81";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
}

sub vcl_recv {
...
if (req.url ~ "^/admin")
{
set req.backend = admin;
}
..
}