<div>HI,</div><div><br></div><div>I am fairly new to varnish, and was curious, is there a way to have all traffic go through varnish to the backend without caching unless for specific pages. For example we only want two pages to be cached, our home, and a specific page under the home as seen below?</div>
<div><br></div><div>Here is my default.vcl </div><div><br></div><div>Thanks</div><div><br></div><div><br></div><div><br></div><div>backend default {</div><div> .host = "127.0.0.1"; </div><div> .port = "80";</div>
<div>}</div><div><br></div><div><br></div><div>sub vcl_recv {</div><div><br></div><div> # for the default home page</div><div> if (req.url ~ "^/") {</div><div> unset req.http.cookie;</div><div> }</div>
<div><br></div><div> </div><div> # if they go directly to /samplepage</div><div> if (req.url ~ "^/samplepage") {</div><div> unset req.http.cookie;</div><div> }</div><div><br></div><div>}</div><div>
<br></div><div>sub vcl_fetch {</div><div> if (req.url ~ "^/") {</div><div> unset beresp.http.set-cookie;</div><div> }</div><div> </div><div> if (req.url ~ "^/samplepage") {</div><div>
unset beresp.http.set-cookie;</div><div> }</div><div> </div><div> </div><div> #override cache headers from backend to keep element in cache for 5 minutes</div><div> if (beresp.ttl < 120s) {</div>
<div> set beresp.ttl = 360s;</div><div> }</div><div><br></div><div>}</div>