RE: [squid-users] GET/POST caching

From: Chris Robertson <crobertson@dont-contact.us>
Date: Mon, 5 Dec 2005 10:08:39 -0900

> -----Original Message-----
> From: Stefan Palme [mailto:kleiner@hora-obscura.de]
> Sent: Monday, December 05, 2005 5:19 AM
> To: squid-users@squid-cache.org
> Subject: [squid-users] GET/POST caching
>
>
>
> Hello,
>
> does squid distinguish between GET and POST URLs? I have an HTML form
> (as part of a CMS) that will be first requested by "GET /form.html".
> When the user submits the form, a "POST /form.html" will be made,
> including the form data in the body of the request.
>
> I want to "GET" request to be cached, because the result is always the
> same (an empty form), but I want the response to the "POST" request
> not to be cached.
>
> Is it enough to put a
>
> acl POSTs method POST
> no_cache deny POSTs
>
> in squid.conf?
>
> I guess, the first GET request will made squid cache "/form.html",
> and the next POST will find the cached object. The no_cache directive
> just says not to cache the response from the origin server, but I
> guess it does not prevent squid from looking in the cache if there
> is already a "/form.html"...
>
> regards
> -stefan-
>

According to the HTTP RFC (http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5) "Responses to [the POST] method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields."

The developers put a lot of effort in to assuring that Squid is RFC compliant, so your example acl won't hurt anything, but won't help either.

Chris
Received on Mon Dec 05 2005 - 12:08:42 MST

This archive was generated by hypermail pre-2.1.9 : Sat Dec 31 2005 - 12:00:02 MST