fastly and/or general varnish subroutine request flow

682 views Asked by At

So Fastly use a modified version of varnish 2.1.5

They don't provide diagrams of the subroutine request flow, but varnish do (see below).

Now according to the below image vcl_hash is only ever entered when you execute a lookup within vcl_recv. But according to an engineer at Fastly...

vcl_hash is executed in almost all cases (except if you restart in vcl_recv)

So which is it? Does anyone know if that's a Fastly specific implementation or just something not indicated by the official varnish diagram and/or are there vcl_* subroutines that are automatically entered when another subroutine finishes?

Any other 'gotchas' people know about?

1

There are 1 answers

0
Ronald On BEST ANSWER

I do not know about fastly but Varnish has a "default.vcl" ("buildin.vcl" in later versions) which defines the default versions of all VCL methods, e.g. "vcl_recv". Here is the 2.1.5 version:

https://github.com/varnishcache/varnish-cache/blob/varnish-2.1.5/bin/varnishd/default.vcl

Now if you do not call "return" in your "vcl_recv" (which you should not unless you explicitly want to return "pass", "error" or "pipe" in some scenario) the default "vcl_recv" is called and it returns "lookup" for all GET/HEAD requests which do not have Cookies or the Authorization-header set.