<div dir="ltr"><div>I want to be able to cache pages that have a cookie. Let's say I have a cookie called "testcookie" that I set up with php.</div><div><br></div><div>If testcookie = 1 I want a page (cached), if testcookie = 2 it will have a different page ( i want to cache it) , and like that N times. This is my current varnish vcl</div><div><br></div><div>____________</div><div><br></div><div><br></div><div>vcl 4.0;</div><div><br></div><div># Default backend definition. Set this to point to your content server.</div><div>backend default {</div><div>    .host = "127.0.0.1";</div><div>    .port = "8080";</div><div>}</div><div><br></div><div><br></div><div><br></div><div>sub vcl_hash {</div><div>hash_data(regsub(req.http.Cookie,"^.*?testvarnish=([^;]*);*.*$" , "\1"));</div><div>}</div><div><br></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>}</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><br></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>}</div><div><br></div><div>________________</div><div><br></div><div>Any idea? Thanks!</div><div><br></div>-- <br><div class="gmail_signature">Raymond Gonzalez</div>
</div>