Forum Discussion
b_seweryn_15157
Nimbostratus
Dec 30, 2015expiresByType caching
hi,
can i configure caching like in apache? I have to implement below few lines for one VS.
ExpiresByType text/javascript "access plus 12 hours"
ExpiresByType image/gif "access plus 12 hours"
Ex...
JRahm
Admin
Jan 01, 2016Here's an old detailed example of what it appears you are trying to accomplish. I've swapped out the findclass command (deprecated in v10+) with the class command:
when HTTP_REQUEST {
if {[HTTP::method] eq "GET" and [HTTP::uri] eq "/"}{
set expire_content_timeout 300
} else {
set extention [string tolower [string range [HTTP::path] [string last . [HTTP::path]] end]]
set expire_content_timeout [class match -value $extention equals cache_timers_by_filetype]
}
}
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 Expires {-1}
}
}
The data-group format from that old example has changed as well:
ltm data-group internal cache_timers_by_filetype {
records {
.bmp {
data 86400
}
.css {
data 3600
}
.gif {
data 86400
}
.htm {
data 300
}
.html {
data 300
}
.ico {
data 604800
}
.jpeg {
data 86400
}
.jpg {
data 86400
}
.js {
data 3600
}
.pdf {
data 604800
}
.png {
data 86400
}
.swf {
data 604800
}
}
type string
}
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
