Forum Discussion
Gustavo_Lazarte
Nimbostratus
Sep 21, 2005Not sending traffic to first pool
Hello,
we just moved from 4.5 and this iRule is not sending any traffic to the edge-fx pool. I tested this iRule with other servers traffic and it is not sending any traffic to the first pool in this iRule,
Any ideas?
thanks
when HTTP_REQUEST {
if {[HTTP::uri] contains "www.website.com" or [HTTP::uri] contains "XX.XX.XX.XX"}{
if {[HTTP::uri] ends_with ".jpg" or [HTTP::uri] ends_with ".gif" or [HTTP::uri] ends_with ".JPG" or [HTTP::uri] ends_with ".GIF"}{
pool edge-fx
} else {
pool web_pool
}
}
}
11 Replies
- JRahm
Admin
Try using [HTTP::host] in the first if statement instead of [HTTP::uri] - Gustavo_Lazarte
Nimbostratus
Thanks
To something like this?
thanks for the help
when HTTP_REQUEST {
if {[HTTP::host] contains "www.website.com" or [HTTP::host] contains "XX.XX.XX.XX"}{
if {[HTTP::uri] ends_with ".jpg" or [HTTP::uri] ends_with ".gif" or [HTTP::uri] ends_with ".JPG" or [HTTP::uri] ends_with ".GIF"}{
pool edge-fx
} else {
pool web_pool
}
}
} - JRahm
Admin
yep. You can add some logging as well while getting used to iRules:when HTTP_REQUEST { log "HTTP host is [HTTP::host] and uri is [HTTP::uri]" if {[HTTP::host] contains "www.website.com" or {HTTP::host] contains "XX.XX.XX.XX"}{ if {[HTTP::uri] ends_with ".jpg" or [HTTP::uri] ends_with ".gif" or [HTTP::uri] ends_with ".JPG" or [HTTP::uri] ends_with ".GIF"}{ pool edge-fx } else { pool web_pool } } } - Wow, I didn't know anyone had an EDGE-FX anymore! Sweet!
As for the iRule, you might want to clean things up with an external classes as well. It makes the iRule much more manageable.==== String Data Groups defined in the GUI ==== class hosts_to_cache { "www.website.com" "XX.XX.XX.XX" } class file_types_to_cache { ".gif" ".jpg" ".GIF" ".JPG" } ==== iRule ==== when HTTP_REQUEST { Note: I replaced "contains" with "equals" here since more than likely you want to do a full string compare on the host name. Change back to "contains" if you want to cover extensions of those host names if { [matchclass [HTTP::host] equals $::hosts_to_cache] } { if { [matchclass [HTTP::uri] ends_with $::file_types_to_cache] } { pool edge-fx } else { pool web-pool } } else { Just pointing out here that you left out the else clause of the first if. } }
-Joe - Gustavo_Lazarte
Nimbostratus
hello,
thanks everybody for the help, may chache server is running great, but i just run into another issue
I tested like 2 hours ago
**************************************************
when HTTP_REQUEST {
if {[HTTP::host] contains "www.website.com" or [HTTP::host] contains "XX.XX.XX.XX"}{
if {[HTTP::uri] ends_with ".jpg" or [HTTP::uri] ends_with ".gif" or [HTTP::uri] ends_with ".JPG" or [HTTP::uri] ends_with ".GIF"}{
pool edge-fx
} else {
pool web_pool
}
}
}
****************************************************
worked fine but it the extra load crashed the cache server and broken images began to show up on my site everywhere,
I guess this iRule will filter the gif and jpg traffic but it will not send any gif + jpg traffic to web_pool in the case edge-fx crashes.
Any suggestions? changes to the iRule?
thanks - Gustavo_Lazarte
Nimbostratus
if i can figure out how to fail gif + jpg to my webpool i will change my IRule to something like
==== String Data Groups defined in the GUI ====
class hosts_to_cache { "www.website.com" "XX.XX.XX.XX"}class file_types_to_cache { ".gif" ".jpg" ".GIF" ".JPG"}
==== iRule ====
when HTTP_REQUEST {
Note: I replaced "contains" with "equals" here since
more than likely you want to do a full string compare
on the host name. Change back to "contains" if you want
to cover extensions of those host names if { [matchclass [HTTP::host] equals $::hosts_to_cache] } { if { [matchclass [HTTP::uri] ends_with $::file_types_to_cache] } { pool edge-fx } else { pool web-pool } } else {
Just pointing out here that you left out the else clause
of the first if.
}
} - drteeth_127330Historic F5 AccountTry adding an LB_FAILED rule. If all members of pool edge-fx are down, then you will get an LB_FAILED event. You can then use web_pool. There are some examples in other posts to this forum. Don't worry about an LB_FAILED loop. The event will only be triggered once. Good luck!
- Gustavo_Lazarte
Nimbostratus
I been looking at my Admin guide and the forum for examples but it is not too clear to me where will the LB_FAILED will be used. Will it go inside the iRule or will it be a separate irule
Thanks for all the help
I really thought this iRule was going to be simplier than this. - Gustavo_Lazarte
Nimbostratus
I have this now,
it looks like it is working, but will the order of the WHEN change the performance of the site thanks again
when HTTP_REQUEST {
if {[HTTP::host] contains "www.website.com" or [HTTP::host] contains "XX.XX.XX.XX"}{
if {[HTTP::uri] ends_with ".jpg" or [HTTP::uri] ends_with ".gif" or [HTTP::uri] ends_with ".JPG" or [HTTP::uri] ends_with ".GIF"}{
pool edge-fx
} else {
pool web_pool
}
}
}
when LB_FAILED {
LB::reselect pool web_pool
} - drteeth_127330Historic F5 AccountI'm not sure I completely understand your question, but I would not expect the LB_FAILED clause to significantly impact the performance of the site.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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