<div dir="ltr">This is my current vcl, can you see what am I doing wrong? Thanks!:<div><br></div><div><div>sub vcl_recv {</div><div> # Happens before we check if we have this in cache already.</div><div> #</div><div> # Typically you clean up the request here, removing cookies you don't need,</div><div> # rewriting the request, etc.</div><div><br></div><div><br></div><div> if (req.method != "GET" &&</div><div> req.method != "HEAD" &&</div><div> req.method != "PUT" &&</div><div> req.method != "POST" &&</div><div> req.method != "TRACE" &&</div><div> req.method != "OPTIONS" &&</div><div> req.method != "DELETE") {</div><div> /* Non-RFC2616 or CONNECT which is weird. */</div><div> return (pipe);</div><div> }</div><div><br></div><div> if (req.method != "GET" && req.method != "HEAD") {</div><div> /* We only deal with GET and HEAD by default */</div><div> return (pass);</div><div> }</div><div><br></div><div><br></div><div># if (req.http.Authorization ) {</div><div># /* Not cacheable by default */</div><div># return (pass);</div><div># }</div><div><br></div><div> if (req.url ~ "test" && req.http.Cookie) {</div><div> return (hash);</div><div> }</div><div><br></div><div><br></div><div> if ( req.http.Cookie) {</div><div> return (hash);</div><div> }</div></div><div><br></div><div><div> return (hash);</div><div>}</div><div><br></div><div><br></div><div>sub vcl_backend_response {</div><div> # Happens after we have read the response headers from the backend.</div><div> #</div><div> # Here you clean the response headers, removing silly Set-Cookie headers</div><div> # and other mistakes your backend does.</div><div>}</div><div><br></div><div>sub vcl_deliver {</div><div> # Happens when we have all the pieces we need, and are about to send the</div><div> # response to the client.</div><div> #</div><div> # You can do accounting or modifying the final object here.</div><div><br></div><div> if (obj.hits > 0) {</div><div> set resp.http.X-Cache = "HIT";</div><div> } else {</div><div> set resp.http.X-Cache = "MISS";</div><div> }</div><div><br></div><div>}</div><div><br></div><div>sub vcl_hash {</div><div><br></div><div> hash_data(req.url);</div><div> if (req.http.host) {</div><div> hash_data(req.http.host);</div><div> } else {</div><div> hash_data(server.ip);</div><div> }</div><div><br></div><div><br></div><div><br></div><div>hash_data(req.http.Cookie);</div><div><br></div><div><br></div><div># if( req.http.Cookie ~ "testvarnish" ) {</div><div># set req.http.X-Varnish-Hashed-On = regsub( req.http.Cookie, "^.*?testvarnish=([^;]*);*.*$", "\1" );</div><div># }</div><div><br></div><div><br></div><div># if( req.http.X-Varnish-Hashed-On ) {</div><div># hash_data( req.http.X-Varnish-Hashed-On);</div><div># }</div><div><br></div><div> return (lookup);</div><div>}</div><div><br></div><div>sub vcl_pass {</div><div> # Called upon entering pass mode. In this mode, the request is passed on to the backend, and the</div><div> # backend's response is passed on to the client, but is not entered into the cache. Subsequent</div><div> # requests submitted over the same client connection are handled normally.</div><div>}</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 13, 2015 at 5:45 PM, Raymond Gonzalez <span dir="ltr"><<a href="mailto:raygo22@gmail.com" target="_blank">raygo22@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I did but it only says what to put in vcl_hash<br>
<div class="HOEnZb"><div class="h5"><br>
> On May 13, 2015, at 5:37 PM, Thomas Lecomte <<a href="mailto:thomas.lecomte@virtual-expo.com">thomas.lecomte@virtual-expo.com</a>> wrote:<br>
><br>
>> On Wed, May 13, 2015 at 11:34 PM, Raymond Gonzalez <<a href="mailto:raygo22@gmail.com">raygo22@gmail.com</a>> wrote:<br>
>> Hi Thomas. Thanks for that. No, I'm very new at working with varnish (1 day old) so don't really know how to do what you are telling me. Could you please let me know what I should put or where can I find a tutorial to do this? A lot of what I've found online is not for V4 so it's not working. Thanks!<br>
><br>
> Have you checked out this page?<br>
><br>
> <a href="https://www.varnish-cache.org/trac/wiki/VCLExampleCacheCookies" target="_blank">https://www.varnish-cache.org/trac/wiki/VCLExampleCacheCookies</a><br>
><br>
> It seems to be Varnish 4-compliant.<br>
><br>
> Hope this helps,<br>
><br>
> --<br>
> Thomas Lecomte<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Raymond Gonzalez</div>
</div>