Purging on form submit

Mattias Geniar mattias at nucleus.be
Wed Jul 6 12:40:21 CEST 2011


> [snip]
>  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:
>

If you can add extra headers for the request, you can just as easily use fsockopen() in PHP to open a socket over port 80 to your Varnish and issue a "PURGE" request. That way, your normal purging ACL's would apply.
That's how the Wordpress Varnish plugin works, see lines 330+ in the following file: https://github.com/ojdupuis/wp-varnish/blob/608b9c5ff276fbb3c3bf61fc9c50b13e882ab2ad/wp-varnish.php

Regards,
Mattias Geniar


More information about the varnish-misc mailing list