Forum Discussion

Christofer_Tib1's avatar
Christofer_Tib1
Icon for Nimbostratus rankNimbostratus
Apr 26, 2006

iRule with several pools bring down whole VS

Hi.

 

I have a VS with a iRule on it that sends the traffic based on the host header to different pools.

 

The problem I'm having now is that if one of these pools goes down then all Wide-IPs (6 of them) that point to this VS also goes down.

 

I would like the Wide-IP only responsible for that pool to go down in this case, the rest of the Wide-IPs should be ok.

 

 

So if as example below pool seldmgt17-http goes down then only test2.test.com wide-ip should go down and not the other two Wide-IP.

 

 

Is there some way to do this in iRules or do we need to use some other thing.

 

I was looking at LB::up but that don't seems to be just right for this.

 

 

Best Regards Christofer Tibbelin

 

 

example

 

 

3 Wide-IP

 

 

test1.test.com

 

members VS(10.10.10.1)

 

 

test2.test.com

 

members VS(10.10.10.1)

 

 

test3.test.com

 

members VS(10.10.10.1)

 

 

VS 10.10.10.1

 

no default pool, only a irule that sends traffic to the different pools.

 

 

iRule: __________________________________________________

 

 

when HTTP_REQUEST {

 

HTTP::header replace "X-origin-IP" [IP::client_addr]

 

 

Don't allow data to be chunked so we can correctly

 

replace payload below

 

if { [HTTP::version] eq "1.1" } {

 

if { [HTTP::header is_keepalive] } {

 

HTTP::header replace "Connection" "Keep-Alive"

 

}

 

HTTP::version "1.0"

 

}

 

 

 

if { [HTTP::host] starts_with "test1.test.com" } {

 

HTTP::uri "/test1[HTTP::uri]"

 

pool seldmgt16-http

 

} elseif { [HTTP::host] starts_with "test2.test.com" } {

 

HTTP::uri "/test2[HTTP::uri]"

 

pool seldmgt17-http

 

} elseif { [HTTP::host] starts_with "test3.test.com" } {

 

if { [ matchclass [IP::client_addr] equals $::proxy_ip_list ] } {

 

HTTP::uri "/test3[HTTP::uri]"

 

pool seldmgt18-http

 

} else {

 

drop

 

}

 

} else {

 

drop

 

}

 

}

4 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    I suppose my first question would be, would you perhaps be better off by relegating this to the Wide-IP level, rather than an iRule?

     

     

    If you want test2.test.com to go to a certain pool, and test1.test.com to go to a different pool, then why not create seperate Wide-IPs and VIPs? This way you'd be able to assign the desired pool to each VIP, and wouldn't have this kind of confusion.

     

     

     

    Colin

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    So, when you say that all the Wide-IPs that point to the VS on the BIG-IP "go down", do you mean that they're reporting as down on the 3DNS system, or that they're just not responding when someone tries to send traffic there?

     

     

    Colin
  • Hi.

     

    They becomes red in the gui.

     

    and they stop responding on dns.

     

    Regards Christofer
  • Hey,

     

     

    I noticed that you are re-writing your URI on every request to force the client into a particular directory structure. Here is a snippet of cleaned up code that may be more efficient for you than rewriting every request.

     

     

    Basically, you look for the URL and matching application dir in the URI. If it matches, it goes to the pool. Otherwise, you get redirected to the original URL/Application DIR. This way, you are not rewriting every request, and clients cannot look outside of your web directory.

     

     

    when HTTP_REQUEST {

     

    if { [HTTP::host] equals "www1.test.com" and [HTTP::uri] starts_with "/www1/"} {

     

    pool www1

     

    } elseif { [HTTP::host] equals "www2.test.com" and [HTTP::uri] starts_with "/www2/"} {

     

    pool www2

     

    } elseif { [HTTP::host] equals "www1.test.com"} {

     

    HTTP::redirect "http://[HTTP::host]/www1/"

     

    } elseif { [HTTP::host] equals "www2.test.com"} {

     

    HTTP::redirect "http://[HTTP::host]/www2/"

     

    } else {

     

    drop

     

    }

     

    }

     

     

    Thanks and good luck!