Forum Discussion
kim_wontae_3483
Nimbostratus
Nov 26, 2010plz chk. cache rule & header rewrite rule
hi just a simple question.
i want selcetive cache & Header Rewrite rule
is that wrong?
can anyone advise me please?
many thanks!
when HTTP_REQUEST {
if { [class match [HTTP::uri] contains class_cacheable_file_types] }
{ CACHE::enable }
else { CACHE::disable }
if {[HTTP::method] eq "GET" and [HTTP::uri] eq "/"}{
set expire_content_timeout 300
}else{
set expire_content_timeout [class match -value [string tolower [string range [HTTP::path] [string last . [HTTP::path]] end]] starts_with class_cacheable_file_types] } }
when HTTP_RESPONSE { if { $expire_content_timeout ne "" } {
HTTP::header replace "Cache-Control" "max-age=$expire_content_timeout, public" HTTP::header replace "Expires" "[clock format [expr ([clock seconds]+$expire_content_timeout)] -format "%a, %d %h %Y %T GMT" -gmt true]"
} else {
HTTP::header replace "Cache-Control" "private"
HTTP::header replace Expires {-1} } }
--------datagroup---------------
class_cacheable_file_types
".jpeg" { "86400" }
...
1 Reply
- hoolio
Cirrostratus
Hi Kim,
That iRule looks good. Have you been able to test it?
Aaron
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
