Forum Discussion
Kevin_Stewart
Oct 17, 2022Employee
Classes are used to search data groups.
There's probably way more elegant ways to do this, but the below extracts the ending from the HTTP::path and searches through the list of endings:
when RULE_INIT {
set static::endinglist { ".jpg" ".jpeg" ".css" ".js" ".ico" ".png" ".gif" ".svg" ".bmp" ".webp" ".avif" ".jxl" ".woff2" ".ttf" ".woff" ".mp4" }
}
when HTTP_REQUEST {
if { [lsearch -all $static::endinglist [string range [HTTP::path] [string last "." [HTTP::path]] end]] ne "" } {
HTTP::header replace Cache-Control "no-cache"
}
}