Hello,
I managed to add an new header:
x-url: /topic/123-my-topic/
So I just need to add this bit?
sub vcl_fetch {
if (req.request == "POST" && beresp.http.x-url) {
purge("obj.http.host == example.com && req.url ~ " beresp.http.x-url);
}
}
Note that I need to purge /topic/123-my-topic/ and /topic/123-my-topic/all
pages after slash.
In this case can I use purge("obj.http.host == example.com && req.url ~ "
beresp.http.x-url.*$);?
Thanks
----- Original Message -----
From: Rob S
Sent: 07/06/11 11:25 AM
To: [email protected]
Subject: Re: Purging on form submit
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