Forum Discussion
Aug 02, 2007
This should work for you.
when HTTP_REQUEST {
set expire [matchclass [HTTP::uri] ends_with $::images]
}
when HTTP_RESPONSE {
if { $expire == 1 } {
HTTP::header insert Expires "[clock format [expr ([clock seconds]+86400)] -format "%a, %d %h %Y %T GMT" -gmt true]"
}
}
Make sure you explicitly set expire to 0 for a non-match otherwise for keep-alive connections across the same session, you most likely will get mixed up and have the expire flag set when you aren't wanting it to be. I accomplished this with the single line set statement. If you do an if statement, make sure you have an else setting the value to 0 for a non-match.
-Joe