when HTTP_REQUEST {
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]
log local0. "[string range [HTTP::path] [string last / [HTTP::path]] end] = $expire_content_timeout "
} }
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}
}
}
댓글 없음:
댓글 쓰기