Forum Discussion
Rusty_Hale_8009
Nimbostratus
Apr 05, 2005iRule conversion from 4.X to V9
I have made an attempt to convert an iRule to V9. Could someone please check my syntax? I would really appreciate it. Thanks.
if { [HTTP::host]
rule Image_Rule {
if (http_host == "www.mydomain.com" and (http_uri ends_with "jpg" or http_uri ends_with "gif")) {
use pool Image_Svr_80
}
else {
use pool Main_Svr_80
}
- JRahm
Admin
Here's my crack, though I don't have a box currently to test on. I'm sure the and/or logic can be reduced, I'm curious if that would make the rule more processor efficient? - JRahm
Admin
I think I missed a bracket or fifty: - citizen_elah,
when HTTP_REQUEST { if { [HTTP::host] equals "www.mydomain.com" } { if { [HTTP::uri] ends_with ".jpg" } { use pool Image_Svr_80 log "JPG file requested by [IP::client_addr]" } elseif { [HTTP::uri] ends_with ".gif" } { use pool Image_Svr_80 log "GIF file requested by [IP::client_addr]" } else { use pool Main_Svr_80 log "Default LB Method for [IP::client_addr]" } } }
when HTTP_REQUEST { if { [HTTP::host] equals "www.mydomain.com" and \ [HTTP::uri] ends_with ".jpg" or \ [HTTP::uri] ends_with ".gif" } { use pool Image_Svr_80 log "Image file requested by [IP::client_addr]" } else { use pool Main_Svr_80 log "Default LB Method for [IP::client_addr]" } }
class images { ".gif" ".jpg" } when HTTP_REQUEST { if { [HTTP::host] equals "www.mydomain.com" and \ [matchclass [HTTP::uri] ends_with $::images] } { use pool Image_Svr_80 log "Image file requested by [IP::client_addr]" } else { use pool Main_Svr_80 log "Default LB Method for [IP::client_addr]" } }
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