May 17, 2011
cache-control header response
Hello , Is there a way to set to intercept the http header response and set cache-control (i.e. set control-control: private and max-age of 7 days) for ONLY static files specified? ...
This worked for me.
if request is a static file, set cache control to be cached on the client machine for 7 days
if { [HTTP::header exists Content-Type] } {
switch -glob [HTTP::header Content-Type] {
"text/javascript" -
"text/css" {
HTTP::header replace "Cache-Control" "private, max-age=604800"
}
}
}
Regards
TRX