<p dir="ltr"><br>
On Dec 23, 2015 20:51, "Xavier Cardil Coll" <<a href="mailto:info@elsitar.com">info@elsitar.com</a>> wrote:<br>
><br>
> No one knows then ? Not even a hint or something ?<br>
><br>
> 2015-12-23 13:15 GMT+01:00 Xavier Cardil Coll <<a href="mailto:info@elsitar.com">info@elsitar.com</a>>:<br>
>><br>
>> Also, how to write a function to bypass cache entirely when a user logs in ? <br>
>><br>
>> 2015-12-23 12:39 GMT+01:00 Xavier Cardil Coll <<a href="mailto:info@elsitar.com">info@elsitar.com</a>>:<br>
>>><br>
>>> On Nginx cache, you can do this to avoid keep on caching when you add something to the cart in Woocommerce :<br>
>>><br>
>>> Skip cache for WooCommerce query string<br>
>>><br>
>>> if ( $arg_add-to-cart != "" ) { <br>
>>> set $skip_cache 1;<br>
>>> }<br>
>>><br>
>>> Skip cache when WooCommerce cart is not empty<br>
>>><br>
>>> if ( $cookie_woocommerce_items_in_cart != "0" ) { <br>
>>> set $skip_cache 1;<br>
>>> }<br>
>>><br>
>>> How can you do this in Varnish ? With this config, wich was made specifically for Wordpress + Woocommerce, when you add something to cart, cache is not disable store wide so you get a mix of cached and non cache pages, cart gets emptied : <a href="http://pastebin.com/TuYeMtUZ">http://pastebin.com/TuYeMtUZ</a><br>
>>><br>
>>><br>
>>> -- <br>
>>><br>
>>> ELSITAR<br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
>> -- <br>
>><br>
>> ELSITAR<br>
>><br>
>><br>
><br>
><br>
><br>
> -- <br>
><br>
> ELSITAR<br>
><br>
><br>
><br>
> _______________________________________________<br>
> varnish-misc mailing list<br>
> <a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
> <a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a></p>
<p dir="ltr">Chill out, most of the people are in vacation :-)</p>
<p dir="ltr">So, in varnish, by default, if the request contains a cookie, the cache is bypassed.</p>
<p dir="ltr">But you can also force a pass, for example if the request contains a "foo-bar" header like so :</p>
<p dir="ltr">sub vcl_recv {<br>
if (req.http.foo-bar) {<br>
return (pass);<br>
}<br>
}</p>
<p dir="ltr">For your needs, look at the query string and cookie vmods, it will allow to really fine-tune your workflow.</p>
<p dir="ltr">And should you need more help, we are here :-)</p>