Forum Discussion
Harold_Deadman_
Feb 22, 2007Nimbostratus
This is the rest of the i-rule that is actually telling the browser to cache stuff. We are removing the Etag because it isn't adding any value over last-modified date and our two IIS servers are returning different Etag values for the same file (because their config's aren't in sync).
Internet Explorer doesn't seem to want to cache anything with a Vary header in it. We haven't tried stripping that out yet, not sure if we can since I think it is being added by the HTTP profile because we have caching and compression on. I don't want the Vary header because we are already telling proxies that the content is private so intermediary caches won't cache it.
when HTTP_RESPONSE priority 900 {
if { (not([HTTP::header exists "Cache-control"])) and (not([HTTP::header exists "Content-Disposition"])) } {
if {not($cachetime == 0)} {
HTTP::header remove "Etag"
HTTP::header remove "X-Powered-By"
HTTP::header insert Cache-Control "private,max-age=$cachetime,post-check=$::postcheck,pre-check=$cachetime,must-revalidate,proxy-revalidate"
HTTP::header replace Expires [clock format [expr ([clock seconds]+$cachetime)] -gmt true -format "%a, %d %b %Y %T %Z"]
} else {
log local0. "Cache time is zero: [HTTP::path]"
}
}
}