Varnish not respecting pass to backend for specified http hosts

Guillaume Quintard guillaume at
Tue Mar 31 21:56:18 UTC 2020


I think there is a bit of confusion regarding what "return(pass)" does.

Basically, when a request comes in, you need to answer two questions:
- do I want to cache it?
- if I need data from the backend, well, what is my backend?

"return(pass)" answers the first question with a big fat "no", and this is
what you see in your log ("VCL_call PASS" and "VCL_return pass"), the
request will be fetched backend, but won't be stored in cache.

You then need to decide where to fetch the data from, but in your vcl, you
only have one backend, so everything comes from the same backend, what you
want is to create a second backend, and do

if (( ~ "( || (")) {
  set req.backend_hint = default;
} else {
  set req.backend_hint = other;
  return (pass);

Hopefully that will clarify things a bit.

Out of curiosity, are you using the official varnish image ( or something else?


Guillaume Quintard

On Tue, Mar 31, 2020 at 2:13 PM Stephen Reese <rsreese at> wrote:

> Running Varnish 6.0.6 in a Docker container for several Wordpress sites. I
> have several domains that I would like to pass to the backend verse having
> them cached, but the configuration is not behaving as intended. Looking to
> understand why I am unable to specify which sites I would like to pass. If
> I do something like:
>     if (( ~ "( || (")) {
>         set req.backend_hint = default;
>     } else {
>         return (pass);
>     }
> then every hostname's content is cached where I would expect only the two
> specified domains to cache, and everything not defined, to pass. Also, if I
> do not specify the configuration, all sites are cached (as expected). If I
> use something like:
>         if (( ~ "( || (")) {
>                 return (pass);
>         }
> then no sites are cached where I would expect everything to cache except
> for the two domains. What might be causing this behavior? I looked at the
> requests with varnishlog, the undefined domains are indeed being fetched
> from the backend verse being cached:
> -   VCL_call       RECV
> -   VCL_acl        NO_MATCH forbidden
> -   VCL_return     pass
> -   VCL_call       HASH
> -   VCL_return     lookup
> -   VCL_call       PASS
> -   VCL_return     fetch
> Varnish configuration is attached.
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list