Forum Discussion
Gerardo_Garcia_
Nimbostratus
Nov 18, 2009SharePoint Caching imgs, js, css
I need you help with an iRule
I need to add a header that will allow the cache of all the content type
application/javascript
image/gif
text/css
image/jpg ...
The_Bhattman
Nimbostratus
Nov 19, 2009Hi Gerardo,
Here is an untested example
when HTTP_RESPONSE {
if { ![HTTP::header exists Cache-Control] and ![HTTP::header exists Expires] and [HTTP::header exists Content-Type] } {
switch -glob [HTTP::header Content-Type] {
"application/javascript" -
"image/gif" -
"text/css"-
"image/jpg" {
HTTP::header insert "Expires" "12/31/2035"
HTTP::header insert "Cache-Control" "public"
}
}
}
}
This assumes that the server response to the client doesn't contain the headers but does contain the Content-Type
NOTE: I haven't tested the validity so you might have to play around with the code
I hope this helps
Bhattman
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