Tag Archives: squid

Squid: How to Enable the PURGE Method for squidclient

By default, the PURGE method is denied with squid, therefore, you cannot use squidclient to purge the cache for a particular page.

The solution to this requires a change in your squid.conf file to allow the PURGE method from localhost.

At my site, squid is installed at /usr/local/squid and the server listens on ports 80 and 8080 instead of the default 3128. You can see what ports squid is listening on with the following:

First, we need to add a couple of acl‘s to the configuration file, one for localhost (if you haven’t defined it already), and one for the PURGE method itself.

Now, we can add our http_access definitions to allow use of the PURGE method when requested by localhost only. Make sure you add both of these entries before your global http_access deny all entry.

Now, we’re ready to ask squid to reload its configuration file.

No errors? Cool. Now we can attempt to PURGE our cache for a particular page …

If the object is in the cache, you should receive a HTTP/1.0 200 OK message. If the object is not in the cache, you’ll be greeted by a HTTP/1.0 404 Not Found message.