Forum Discussion

Andrew_Galvin_2's avatar
Andrew_Galvin_2
Icon for Nimbostratus rankNimbostratus
Feb 14, 2006

Help withcatch-all for iRule

Folks

 

 

I am hoping someone can provide some advise for this, I am relatively new to iRules. I have an iRule that checks HTTP::uri for various strings and directs traffic to a pool based on that. The complete iRule is at the bottom of this post. We have discovered that some applications are communicating using the weblogic t3 protocol rather than http. So for that traffic the rule is never matched and the traffic goes into a black hole. I would like a catch-all at the end of the rule that will send any traffic other than http to a default pool but I am unsure how to achieve this. I had hoped that placing this at the end of the iRule would provide a solution:

 

 

when CLIENT_DATA {

 

if { ([TCP::local_port] == 8020) } {

 

pool evo_3dns_pool

 

}

 

}

 

 

But it has been pointed out that this will intercept all traffic (even the http specified at the top of the iRule) and send everything to the default pool. Any thoughts on how I progress?

 

 

rule Evo_iRules {

 

when HTTP_REQUEST {

 

if { [HTTP::uri] starts_with "/nws" } {

 

log " [HTTP::uri] - using evo_news_pool"

 

pool evo_nws_pool

 

} else {

 

if { [HTTP::uri] starts_with "/wea" } {

 

pool evo_wea_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/adt" } {

 

pool evo_adt_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/alerts" } {

 

pool evo_alerts_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/afl" } {

 

pool evo_afl_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/alm" } {

 

pool evo_alm_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/aqe" } {

 

pool evo_aqe_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/bbr" } {

 

pool evo_bbr_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/com" } {

 

pool evo_com_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/crk" } {

 

pool evo_crk_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/gme" } {

 

pool evo_gme_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/mca" } {

 

pool evo_mca_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/mus" } {

 

pool evo_mus_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/pfs" } {

 

pool evo_pfs_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/pic" } {

 

pool evo_pics_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/rbg" } {

 

pool evo_rbg_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/rlg" } {

 

pool evo_rlg_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/run" } {

 

pool evo_run_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/soc" } {

 

pool evo_soc_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/spo" } {

 

pool evo_spo_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/sta" } {

 

pool evo_sta_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/swat" } {

 

pool evo_swat_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/ton" } {

 

pool evo_ton_pool

 

}

 

else {

 

if { [HTTP::uri] starts_with "/vws" } {

 

pool evo_vws_pool

 

}

 

else {

 

pool evo_3dns_pool

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

}

 

3 Replies

  • my guess would be that because this isn't HTTP, you can't match the catch-all traffic within the HTTP_REQUEST event. I think I have some t3 captures buried in my hard drive somewhere--I'll try and look at them today. If I recall correctly t3 is not well documented at all, but if there is a consistent identifier, you could do a tcp::collect at CLIENT_ACCEPTED and then evaluate t3 or http in CLIENT_DATA. If t3, find string to switch on and send to appropriate pool, if http, issue tcp::release. At this point the HTTP_REQUEST event should pick up the rest of your rule.
  • Lee_Orrick_5554's avatar
    Lee_Orrick_5554
    Historic F5 Account
    You may want to try adding a default pool in your virtual definition. I think if no pool selected through the iRule it will be sent to the default pool if it is defined.
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Yes, lorrick is correct. I will add that pool selection is always a replacement operation (unless no default pool is specified). So, you can select pools as many times as you want, but only the last one will have an effect.

     

     

    So, you could certainly add a default pool to the virtual which would then be overridden by your logic in the HTTP_REQUEST event. You could also define a CLIENT_ACCEPTED event and set a pool there, yet still have the HTTP_REQUEST event override that pool with another one.

     

     

    HTH