Forum Discussion
cache-control header response
Is there a way to set to intercept the http header response and set cache-control (i.e. set control-control: private and max-age of 7 days)
for ONLY static files specified?
Thanks!
Regards,
Traolly Xiong
- hooleylistCirrostratusHi Trx,
- We are on version BIG-IP 9.4.5 Build 1049.10 Final. Will your approach work with this version? If we can modify the cache headers at the f5 level, we NO longer need caching configuration on our app servers or IIS web servers. This would be great and save time testing/debugging.
- hooleylistCirrostratusThis should work fine on 9.4.5. You'd want to use matchclass and/or findclass to do the lookups against the datagroup(s).
- Thanks.
- hooleylistCirrostratusHi TRX,
when HTTP_RESPONSE { if { [HTTP::header Content-Type] ne ""} { if {[matchclass [HTTP::header Content-Type] equals static_content_types_class]}{ HTTP::header replace "Cache-Control" "private, max-age=604800" } } }
- I think the class are only allowed in version 10.x correct?
I defined a class but can't save it.
ex)
class static_Files {
{"zip""rar""js""css""ppt""pptx""doc""docx""xls""xlsx""pdf""jpeg""jpg""png""gif"}}
I get an error "undefined procedure: class]...
Thoughts?
Regards,
TRX
- hooleylistCirrostratusA datagroup is a separate object from an iRule. You can define a datagroup in any LTM version under Local Traffic >> iRules >> Datagroup tab.
- Now would I just do something similar like this after creating it?
- hooleylistCirrostratusYou can use this example:
- hooleylistCirrostratusThat looks right. Do you see any TCL errors in the /var/log/ltm file? Did you update the name of the datagroup in the iRule to static_files_TRX?
Recent Discussions
Related Content
* 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