<div dir="ltr">
<div class="gmail-post-text">
<p>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:</p>
<pre><code> if ((req.http.host ~ "(<a href="http://domain.com">domain.com</a>) || (<a href="http://dev.domain.com">dev.domain.com</a>)")) {
set req.backend_hint = default;
} else {
return (pass);
}
</code></pre>
<p>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:</p>
<pre><code> if ((req.http.host ~ "(<a href="http://domain.com">domain.com</a>) || (<a href="http://dev.domain.com">dev.domain.com</a>)")) {
return (pass);
}
</code></pre>
<p>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 <code>varnishlog</code>, the undefined domains are indeed being fetched from the backend verse being cached:</p>
<pre><code>- VCL_call RECV
- VCL_acl NO_MATCH forbidden
- VCL_return pass
- VCL_call HASH
- VCL_return lookup
- VCL_call PASS
- VCL_return fetch<br><br></code></pre><pre><code></code>Varnish configuration is attached.</pre>
</div>
</div>