Forum Discussion
Darren_Person_2
Nimbostratus
Aug 17, 2007RAMCACHE - caching POST?
We just enabled RAMCache utilizing the profiles, but I think we are going to need to use iRules. We are running into an issue with AJAX (doing POST's), but ramcaching thinking that they are GET requests.
For example, we have a page which has an web module utilizing built in paging. On the first hit of the page, I see the item get put into cache (Using an HTTP Proxy). On the second request (AJAX), I see the POST request being submitted and then I see the cache hit value go up each time. I was under the impression that RAMCACHE did NOT cache POST requests. Am I missing a setting somewhere?
Any help you can provide would be greatly appreciated!
2 Replies
- Deb_Allen_18Historic F5 AccountThe LTM manual states: The RAM Cache feature is fully compliant with the cache specifications described in RFC 2616, Hypertext Transfer Protocol -- HTTP/1.1. This means that you can configure RAM Cache to cache the following content types:
* 200, 203, 206, 300, 301, and 410 responses.
* Responses to GET methods by default.
* Other HTTP methods for URIs specified in the URI Include list or specified in an iRule.
* Content based on the User-Agent and Accept-Encoding values. The RAM Cache holds different content for Vary headers.
And HTTP 1.1 does allow caching of the response to a POST request -- from RFC2616, section 9.5:Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields.I'd hazard a guess that your POST response is coming back with response code 200 OK and no response headers that would prevent caching. Looking at the http profile (where RAM cache is configured), it doesn't appear that you can configure by method or response code, so the fix would be to have your servers insert cache control headers into POST responses.
HTH
/deb - Darren_Person_2
Nimbostratus
Hi Deb - here is the fix - we created an iRule:
when HTTP_REQUEST {
set method [HTTP::method]
if { $method == "POST" } {
CACHE::disable
}
else {
CACHE::enable
}
}
This has fixed the problem - for the record, POST's should not be CACHED! At least, not in a traditional web environment with multiple external users.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects