<div dir="ltr">Hi,<div><br></div><div>I think there is a bit of confusion regarding what "return(pass)" does.</div><div><br></div><div>Basically, when a request comes in, you need to answer two questions:</div><div>- do I want to cache it?</div><div>- if I need data from the backend, well, what is my backend?</div><div><br></div><div>"return(pass)" answers the first question with a big fat "no", and this is what you see in your log ("<span style="white-space:pre-wrap">VCL_call       PASS</span>" and "<span style="white-space:pre-wrap">VCL_return     pass</span>"), the request will be fetched backend, but won't be stored in cache.</div><div><br></div><div>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</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">if ((req.http.host ~ "(<a href="http://domain.com">domain.com</a>) || (<a href="http://dev.domain.com">dev.domain.com</a>)")) {</font></div><div><font face="monospace">  set req.backend_hint = default;</font></div><div><font face="monospace">} else {</font></div><div><font face="monospace">  set req.backend_hint = other;</font></div><div><font face="monospace">  return (pass);</font></div><div><font face="monospace">}</font></div></blockquote><div><br></div><div>Hopefully that will clarify things a bit.</div><div><br></div><div>Out of curiosity, are you using the official varnish image (<a href="https://hub.docker.com/_/varnish">https://hub.docker.com/_/varnish</a>) or something else?</div><div><br></div><div>Cheers,</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 31, 2020 at 2:13 PM Stephen Reese <<a href="mailto:rsreese@gmail.com">rsreese@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">

        
    
    <div>

<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" target="_blank">domain.com</a>) || (<a href="http://dev.domain.com" target="_blank">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" target="_blank">domain.com</a>) || (<a href="http://dev.domain.com" target="_blank">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>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>