Note that there are some explanatory texts on larger screens.

plurals
  1. POVarnish: Clear Cache after POST data
    primarykey
    data
    text
    <p>I have a Plone website that sits behind Varnish. All is working OK except for one thing.</p> <p>This is a dynamic site and hence there will be new content from time to time. The scenario is as follows:</p> <p>I have a page that displays a list of items. This page has been cached. So I add another item via some form, and return to the same page, but the new item is not shown. This is because the page displayed is from the cache and is still within its TTL.</p> <p>How can I ensure that upon submitting of a new item, that page is purged from the cache, and a new page from the backend server with the new item will be displayed?</p> <p>My simple VCL is as shown:</p> <pre><code>backend default { .host = "127.0.0.1"; .port = "8080"; } sub vcl_recv { if (req.request != "GET" &amp;&amp; req.request != "HEAD") { # We only deal with GET and HEAD by default return (pass); } # remove unnecessary cookies if (req.http.cookie ~ "wc.cookiecredentials|Path|Domain") { # found wc.cookiecredentials in request, passing to backend server return (lookup); } else { unset req.http.cookie; } } sub vcl_fetch { #unset beresp.http.Set-Cookie; set beresp.ttl = 12h; return(deliver); } # Routine used to determine the cache key if storing/retrieving a cached page. sub vcl_hash { # Do NOT use this unless you want to store per-user caches. if (req.http.Cookie) { set req.hash += req.http.Cookie; } } sub vcl_deliver { # send some handy statistics back, useful for checking cache if (obj.hits &gt; 0) { set resp.http.X-Cache-Action = "HIT"; set resp.http.X-Cache-Hits = obj.hits; } else { set resp.http.X-Cache-Action = "MISS"; } } </code></pre> <p>Or to put it plainly, how can I purge or clear the entire cache for the domain whenever I receive a POST request?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload