Forum Discussion
rb1980_75708
Nov 21, 2008Nimbostratus
not caching on stream_matched problem
I have an interesting problem I'm hoping can be solved with an iRule:
I have a cgi that proxies to a back-end verity cluster to retreive search results. Occasionally, (because of a problem on the verity servers) I get a bogus reply with 0 results. This ends up getting cached on WA and served to subsequent requests for the same search.
Here is an example of one of the bogus search results:
{
"gutter_url" : "",
"sort_order" : "popularity",
"sort_by" : "album",
"num_results" : 0,
"status" : "SUCCESS",
"type" : "BROWSE",
"elapsed" : 10.086959
}
I'd like to have rule that follows this basic logic:
1. Identify search request by uri starts_with "/search-cgi"
2. Look for above string '"num_results" : 0,' in response to above request.
3. Tell WA to not cache this response.
I have the basic shell of the iRule as follows, but it's not working: The WAM is still caching the response and serving the next request with X-Pvinfo code S10102. Another thing I cannot figure out how to do is send a no-cache header on the response so the client browser does not cache it locally.
I'd appreciate any help with this.
when HTTP_REQUEST {
set searchreq 0
if { [HTTP::uri] starts_with "/search-cgi" } {
set searchreq 1
log local0. "SEARCH REQUEST: [HTTP::uri]"
}
}
when HTTP_RESPONSE {
STREAM::disable
if {$searchreq == 1} {
STREAM::expression {@"num_results" : 0,@}
STREAM::enable
}
}
when STREAM_MATCHED {
set badreq 1
log local0. "BAD SEARCH RESULT: [STREAM::match]"
not working for WAM:
CACHE::disable
}
- rb1980_75708NimbostratusI suspect (but can't find any proof at the moment) that the CACHE::disable only works for LTM RAM cache, not WAM, am I right? (still learning). If so: Is there any other method available via an iRule to tell WAM to not cache?
- hooleylistCirrostratusHi RB,
- I'll start with the easy question first - how to send a no-cache header in the response so the client does not cache the item. This is controlled from within the policy's lifetime settings. The last section is the client cache settings there are options for do not change which will pass on the settings from the origin server, maximum age where you can specify a lifetime, and Insert no-cache directive which will instruct the client not to cache.
- rb1980_75708Nimbostratuslooks like this is not something the WA can do... will need to try and solve the problem on the origin side.
- hooleylistCirrostratusI wasn't suggesting editing the stock WA iRule--just looking at it to see if there are any hooks that would allow for disabling caching. In the pre-9.4.2 ASM clientside rule you could bypass ASM on requests by setting asm_bypass to 1 in a separate iRule on the VIP. Even so, editing the rule shouldn't invalidate your support contract. I think you'd just have to change it back to the original version in order to get support for the configuration.
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