What is the HTTP method PURGE?

Sam Berry picture Sam Berry · Sep 15, 2014 · Viewed 23.1k times · Source

Today when using Postman I noticed the method option of PURGE. I have never encountered it in practice and cannot find the explanation of it's purpose.

What is this method used for, where did it come from, and is there a spec for it somewhere?

Answer

Remy Lebeau picture Remy Lebeau · Sep 16, 2014

There is an HTTP PURGE method, though it is not defined in the HTTP RFCs (which do allow for custom methods beyond the standard defined methods). Some HTTP servers and caching systems actually do implement PURGE, for instance Squid and Varnish:

Squid: How can I purge an object from my cache?

Varnish: Purging and banning

And it is possible to send PURGE requests with curl, for example:

Varnish purge using HTTP and REGEX