httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: [users@httpd] cache POST requests
Date Tue, 10 Feb 2009 19:39:10 GMT
Anthony J. Biacco wrote:
> Hello,
> I'm using apache 2.2.11 on centos 5/x86_64
> I'm testing out caching data for GET requests using mod_disk_cache,
> which I have working.
> I'd also like to cache data for the same requests via the POST method,
> but this doesn't seem to work.
> Is this supported? If so, is there any config changes required for this
> to work? If not, is this feature planned?
Let me refer you to the following document :
(that is the official definition of the HTTP protocol, and how it works).
Really.  Seriously. I am not pulling your leg.  I guarantee that if you 
read it seriously, you would not need to ask the question above, because 
you would understand why it does not make sense.

Check section 9, which explains the various methods such as GET and 
POST, and their differences.
In short, it explains that GET is a method that is "idempotent", and 
POST is not.
In normal language, it means that when you do a GET, and then you do the 
same GET again, it should give you the same response.  That is what is 
meant by "idem potent".
(Typical usage : a search in a database)
On the other hand, a POST means that the information you send in the 
POST, can modify something on the server.  Which means that after you do 
a POST, the server may "not be the same" anymore.  So if you re-do the 
same POST, the answer may be different, because your first POST will 
have changed something on the server.
(Typical usage : do some "data entry" on the server)

That is why it makes sense to cache the results of a GET : since in 
principle doing the same GET later would give you the same response 
anyway, then why not cache it, and avoid asking for the same response 
again ?
But a POST is another animal.  There would be little point in caching 
the response, because the next time you make the same POST request, in 
principle the response will be different, so there is no point in 
caching the previous one.

Many people think that the difference between a GET and a POST is how 
the paremeters are passed to the server.  That is not true at all. Both 
can pass the parameters in two ways, the same two ways for both.
The difference is not in how you pass the values to the server. The 
difference is in what you expect your request to do at the server side.

In other words, the simple answer to your question is : No.
No browser, no webserver, no proxy server will nor should /ever/ cache 
the response to a POST. It would be contrary to the HTTP specification.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message