Forum Discussion
Kevin_Davies_40
Aug 11, 2011Nacreous
Peter,
- Switch does not support an else statement.
-The S in "Scripts/*.js" should be s or it will never match.
- logging all traffic generates quite a lot of data - added debug flag. Set to 1 for testing, 0 for production.
The code should look like....
when HTTP_REQUEST {
set debug 0
switch -glob [string tolower [HTTP::uri]] {
"text/*javascript" -
"scripts/*.js" -
"text/*.css" -
"image/*.swf" -
"image/*.gif" -
"image/*.png" -
"image/*.jpg" -
"image/*.jpeg" {
CACHE::enable
if {$debug} { log local0. "Caching [HTTP::uri]" }
}
default {
CACHE::disable
if {$debug} { log local0. "Non Caching [HTTP::uri]" }
}
}
}
Jarvil
Tip - When pasting iRules put inside "code" blocks then submit, edit, submit to get the code looking like above.