Forum Discussion
Jeff_C_42204
Nimbostratus
Aug 01, 2007Irule to set expires headers for static conent
Hello Dev Central!
I have an IIS 6.0 server that is not setting the expires header (cache-control is set) which is causing a potential performance issue.
I would like to remedy th...
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
