Forum Discussion
Migration tomorrow from v9 to v11 - cache
I am doing a migration from an older version (v9) to a new one (v11) shortly and I want to know as to whether or not this iRules will work from v9. I know "matchclass" has been deprecated inV10 and v11 and I must replace the matchclass Command in iRules with the "class match" Command. Do you think I need to change anything in this Irule ? Thank you for your help
Irule CACHE iRule is:
when HTTP_REQUEST {
set host [HTTP::host]
set uri [HTTP::uri]
set domi [substr [HTTP::host] 3 80]
set ip [IP::client_addr]
set expire_content_time [findclass [HTTP::uri] $::class_cacheable_pages " "]
if { ($expire_content_time eq "") } { set expire_content_time [findclass [string tolower [string range [HTTP::path] [string last . [HTTP::path]] end]] $::class_cacheable_files " "] }
if { ([matchclass [HTTP::path] starts_with $::class_no_cacheable_pages]) } { set expire_content_time "" } }
when HTTP_RESPONSE {
if { [HTTP::cookie exists "PHPSESSID"] } { set cookieDomain [HTTP::cookie domain "PHPSESSID"] if { ($cookieDomain starts_with "www") or ($cookieDomain eq "") } { HTTP::cookie
domain "PHPSESSID" "$domi" }
}
if { [HTTP::status] == 404 } {
if { $host starts_with "private" } {
log -noname 10.10.10.50:514 local4.info "ERROR 404 $uri"
return }
if { ($host contains "ecd2016") or ($host contains "mps2015") or ($host starts_with "old") or ($host starts_with "ecd2016") } { return }
HTTP::redirect "http://www.TOTO.org/error.php"
HTTP::respond 404 content $::error_404 "Content-Type" "text/html" return }
if { $ip equals "10.10.10.31" } { HTTP::header insert "serverName" [LB::server addr] }
if { $expire_content_time ne "" } {
HTTP::header replace "Cache-Control" "max-age=$expire_content_time"
HTTP::header replace "Expires" "[clock format [expr ([clock seconds]+$expire_content_time)] -format "%a, %d %h %Y %T GMT" -gmt true]"
}
else {
HTTP::header replace "Cache-Control" "max-age=60"
HTTP::header replace "Expires" "[clock format [expr ([clock seconds]+60)] -format "%a, %d %h %Y %T GMT" -gmt true]" } }
1 Reply
- Vijay_E
Cirrus
set expire_content_time [findclass [HTTP::uri] $::class_cacheable_pages " "]findclass may not be used in v11 as it was in v9: https://devcentral.f5.com/wiki/iRules.findclass.ashx
Before you upgrade, I would recommend that you make sure to open a case with F5 as the v11 code version tends to consume a lot more resources and if you are running a old hardware, it may not be compatible or may give very low performance.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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