On 06/07/2011 10:26, Nuno Neves wrote:
how can I get the hiden input value I have that tell varnish that we have a new post?

<input type="hidden" name="canpurge" value="/topic/123-my-topic/" />

I was thinking of something like this:

sub vcl_recv {
    if (req.request == "POST" && FORM.FIELD == "canpurge) {
purge req.http.host == example.com && req.url ~ ^FORM.CANPURGE.VALUE.*$
    }
}

Nuno:

Varnish can't see the body of the response. However, if you're able to change the response, you can just add an HTTP header with this information. Then, in vcl_fetch (which is where the HTTP request is sent to the backend), you can probably add something like:

sub vcl_fetch {
  if (beresp.http.x-purgepattern) {
purge("obj.http.host == example.com && req.url ~ " beresp.http.x-purgepattern);
  }
}


Rob
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to