Forum Discussion
Craig_Freyman_1
Nimbostratus
Oct 17, 2005NO-Caching certain files with BIP
Trying to write an IRule to make client computers not cache certain file types. We can not have our client computers download any files that start with "slide" or "ps" into their temporary internet files.
I have tried the following however the files are still caching into the Temp internet files.
when HTTP_REQUEST {
if {[HTTP::uri] contains "slide."} {
set foundmatch 1
}
if {[HTTP::uri] contains "ps."} {
set foundmatch 1
}
else {
set foundmatch 0
}
}
when HTTP_RESPONSE {
if {$foundmatch == 1} {
HTTP::header replace Cache-Control no-cache
HTTP::header replace Pragma no-cache
}
}
Any ideas out there???
Thanks!
- Colin_Walker_12Historic F5 AccountWell, first I'd recommend a few tweaks to the rule to make it A.) more efficient, and B.) more effective.
when HTTP_REQUEST { set foundmatch 0 if { ([HTTP::uri] contains "slide") or ([HTTP::uri] contains "ps") } { set foundmatch 1 } } when HTTP_RESPONSE { if {$foundmatch == 1} { HTTP::header replace Cache-Control no-cache HTTP::header replace Pragma no-cache } }
- Craig_Freyman_1
Nimbostratus
Thanks for that. I put the change in and it is still not working. I'm wondering if I should be using some sort of wild card characters because maybe there isnt a match being made. When you use the "contains" does it just look for that string anywhere in the URI? - Colin_Walker_12Historic F5 AccountTo answer your question, yes, the contains operator matches the compared text anywhere in the variable you're referencing. It is not, by default, case insensitive, though. For that, you'd need to use the tolower command.
when HTTP_REQUEST { set foundmatch 0 if { [string tolower [HTTP::uri] ] contains "openmeetingversioncheck.swf" } { set foundmatch 1 } } when HTTP_RESPONSE { if {$foundmatch == 1} { HTTP::header replace Cache-Control no-cache HTTP::header replace Pragma no-cache } }
- Craig_Freyman_1
Nimbostratus
Ok it looks like the headers are being changed based on my sniffer: - Colin_Walker_12Historic F5 AccountWell, it looks like your rule is performing as expected. It is setting the no-cache information as desired, but the browser is still caching things.
- unRuleY_95363Historic F5 AccountYou might try sniffing what the response looks like when using the Apache server to disable the caching and then comparing the response headers to see what the differences are. Our caching guru (bl0ndie) went home for the night, maybe he will chime in later...
- Craig_Freyman_1
Nimbostratus
So here is the difference with a specific GET between Apache and BigIP - rapmaster_c_127Historic F5 AccountIn our experience with HTTP clients and servers, we have not come across any that are intentionally sensitive to the ordering of non-duplicate headers in the request or response.
- Craig_Freyman_1
Nimbostratus
That is the track I was going down. When I changed my browser settings to use HTTP 1.1 it works great. So now I'm trying to figure out why the Pragma: no-cache is not working for 1.0 clients. I belive it has something to do with an Expires tag, also. - rapmaster_c_127Historic F5 Account
accessor. It returns "0.9", "1.0", or "1.1", depending on the headers being sent.HTTP::version
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