For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

stephane_dobbel's avatar
stephane_dobbel
Icon for Nimbostratus rankNimbostratus
Mar 12, 2014

redirect to another pool when primary pool unavailable.

Hello, I want to use irule without success to redirect to another pool if members are down.

when HTTP_REQUEST {

    sets the timer to return client to host URL
   set stime 10

    Use the Host header value for the responses if it's set.  If not, use the VIP address.
   if {[string length [HTTP::host]]}{
      set host [HTTP::host]
   } else {
      set host [IP::local_addr]
   }

    Check if the URI is /maintenance

   if { [active_members P_Prod] < 1 } {


        HTTP::uri /
    pool P_Sorry_Pool

   }
}

When I disable members in prod pool, the P_Sorry_Pool seems not use . If I use the P_Sorry_Pool in the http_class define for this website, it's work fine . ( Just need flush ramcache when I want to return to prod pool ).

Any idea ?

Thanks

8 Replies

  • Okay, I misspoke earlier. You were disabling the prod pool members, which should have been enough to cause traffic to flow to the sorry pool regardless of a health monitor. In any case, the syntax still looks correct. Can you modify it as follows and report what it does:

    when HTTP_REQUEST {
        if { [active_members [LB::server pool]] < 1 } {
            pool P_Sorry_Pool
            HTTP::uri "/"
        }
    }
    
  • Nothing change . Browser detect a bad redirection .

     

    For information : ltm profile httpclass /Convergence/httpclass_Prod { app-service none asm enabled defaults-from /Common/httpclass hosts { glob:mysite.com } pool /Convergence/P_Prod redirect none }

     

    The pool server Sorry is a basic Apache server .

     

  • So just curious, but why do you have this http class applied if you have the pool defined in the VIP? Can I assume your intention here is to direct traffic to the prod pool if the host matches "mysite.com"?

     

    Also check /var/log/ltm for any errors. An iRule error will usually manifest as a bad response in the browser, and you should see something in the log.

     

    Worst case the pool selection could be working but the sorry server is sending something the browser doesn't understand. Performing a client side capture to see if you you're actually seeing HTTP payload from the sorry server might help.

     

  • The pool is not define in the VIP but in the Http class. /var/log/ltm don't give informations... 😕 just when there is a wrong syntax in the irule.

    ltm virtual /Convergence/VS_Convergence_Prod {
        destination /Convergence/X.X.X.X:80
        http-class {
            /Convergence/httpclass_Convergence_Prod
        }
        ip-protocol tcp
        mask 255.255.255.255
        persist {
            /Convergence/cookie-Convergence {
                default yes
            }
        }
        profiles {
            /Common/http-x-forwarded-for { }
            /Common/tcp-lan-optimized {
                context serverside
            }
            /Common/tcp-wan-optimized {
                context clientside
            }
            /Convergence/analytics-full { }
        }
        rules {
            /Convergence/rule_Convergence_Prod
        }
        snat automap
        translate-address enabled
        translate-port enabled
        vlans-disabled
    }
    

    I will do a capture. Thank you

  • I don't have a pre-11.4 system in front of me to test this with an HTTP class, but given that your class is pointing one host to one pool, why not just assign the pool to the VIP?

     

  • Because I use the http_class to link the asm and URIs. do you think it will be a problem ? I can try with a VIP -> pool without http_class.