when HTTP_REQUEST {
if {[HTTP::method] eq "GET" and [HTTP::uri] eq "/"}{
set expire_content_timeout 300
} else {
set expire_content_timeout [findclass [string tolower [string range [HTTP::path] [string last . [HTTP::path]] end]] $::class_cacheable_file_types " "]
log local0.debug "$expire_content_timeout"
#log local0.debug "[string tolower [string range [HTTP::path] [string last . [HTTP::path]] end]]"
} }
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}
}
}