This is actually a fairly simple iRule (well, as far as iRules go anyway). Now, whether or not something like this should be more easily configured "out-of-the-box" is really a subjective thing. It really depends on how many use cases are likely to do something like that (we haven't come across any yet that have told us). We feel that ultimately, having a powerfully expandable and configurable methodology is better than having just a few capabilities configurable out-of-the-box. Again, this is highly subjective and dependent on just how many instances are doing that "thing".
Anyway, this rule should get you started:
First, create a string datagroup/class called my_file_types that contains the extensions for the file types you want the Cache control header added. This will create a configuration object that looks like this in the bigip.conf:
class my_file_types {
".htm"
".foo"
".bar"
}
Then make sure your virtual has an HTTP profile and add the following rule (and assign it to your virtual):
when HTTP_REQUEST {
if { [matchclass [HTTP::uri] ends_with $::my_file_types] } {
HTTP::header replace Cache-Control "private,max-age=86400,must-revalidate,proxy-revalidate"
}
}
You can then customize this rule for whatever you might eventually want to use to denote the file type. For example, maybe you want to use the Content-Type header instead, or do multiple checks on the URI like does it contain a particular directory element and ends with a particular file type.
Ultimately, the only way to provide complete flexibility is through the use of a free-form programming language like iRules.
I hope this stuff doesn't scare you off...