Purging on form submit
Laurence Rowe
l at lrowe.co.uk
Thu Jul 7 00:10:42 CEST 2011
In Varnish 3 it has been renamed to 'ban'. See
https://www.varnish-cache.org/docs/3.0/tutorial/purging.html
Laurence
On 6 July 2011 20:28, Nuno Neves <nfn at gmx.com> wrote:
> Hello,
> Using this code I get an error when starting varnish 3.0
> The code:
> sub vcl_fetch {
> if (beresp.http.X-Purge) {
> purge("obj.http.host == example.com && req.url ~ " beresp.http.X-Purge);
> }
> }
>
> The error:
> * Starting HTTP accelerator varnishd
> ...fail!
> SMA.s0: max size 256 MB.
> Message from VCC-compiler:
> Expected ';' got '('
> (program line 174), at
> ('input' Line 52 Pos 11)
> purge ("obj.http.host == example.com && req.url ~ "
> beresp.http.X-Purge);
> ----------#---------------------------------------------------------------------------
> What do I need to change?
> Thanks
> Nuno
>
>
> A 2011/07/06, às 11:25, Rob S escreveu:
>
> 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
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
More information about the varnish-misc
mailing list