RE: cache POST requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I did in fact read the rfc before I posted, but it seems to me that once you're doing proxying to an application server, these facts don't apply anymore. I could be way off base. But a GET proxied to an application server doesn't have to, and (depending on how the webapp is designed) doesn't return the same response, based on the state of the application server (and anything behind it). And in turn, a POST can return the same response to the same POST request..that is of course (for the POST) if you don't take just the URI into account, but the whole request (i.e. keys and values).
Please correct me if I'm misunderstanding. Perhaps the rfc just isn't taking in account application servers (and perhaps shouldn't)..or I'm an idiot. One of the two.

-Tony
---------------------------
Manager, IT Operations
Format Dynamics, Inc.
303-573-1800x27
abiacco@xxxxxxxxxxxxxxxxxx
http://www.formatdynamics.com


-----Original Message-----
From: André Warnier [mailto:aw@xxxxxxxxxx] 
Sent: Tuesday, February 10, 2009 12:39 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  cache POST requests

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?
> 
Hi.
Let me refer you to the following document :
http://www.ietf.org/rfc/rfc2616.txt
(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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux