Forum Discussion

collinz1_17223's avatar
collinz1_17223
Icon for Nimbostratus rankNimbostratus
Apr 10, 2013

irule: Members down, select pool and URI

I have an irule that we have used now for some time:

 

 

when HTTP_REQUEST {

 

if { [active_members [LB::server pool]] < 1} {

 

snat automap

 

pool pool_sorry

 

}

 

}

 

 

This irule works fine, however what I now want to be able to do is sent HTTP requests to a pool / pool member and specific URI when the active_members is <1.

 

 

To clarify the new irule would look something like this (syntaxes obviously not correct, but just to get what I am trying to achieve across)

 

 

when HTTP_REQUEST {

 

if { [active_members [LB::server pool]] < 1} {

 

snat automap

 

pool pool_sorry /page1.aspx

 

}

 

}

 

 

Any ideas would be greatly appreciated, I know I can do a simple HTTP::redirect but I am trying to avoid this.

 

 

7 Replies

  • I would have thought this would do it;

    
    when HTTP_REQUEST {
     if { [active_members [LB::server pool]] < 1} {
      snat automap
      HTTP::uri "/page1.aspx"
      pool pool_sorry
     }
    }
    
  • You can use the HTTP::uri command to (re)set the URI:

    
    when HTTP_REQUEST {
            if { [active_members [LB::server pool]] < 1} {
                    snat automap
                    HTTP::uri "/page1.aspx"
                    pool pool_sorry
            }
    }
    
  • Thanks for your responses guys, that does indeed achieve what I was after, the only problem I seem to have now is that if the Virtual Server that this rule is associated to is an SSL site the F5 attempts to connect to the “pool_sorry” on port 443, even though the pool member are setup for port 80.

     

    This happens regardless of whether you have an SSL Profile (Server) configured for your normal pool.

     

  • So just to clarify, do you have a server SSL profile assigned to the virtual server? If so you'll need to disable that profile when sending traffic to the port 80 sorry pool.

    
    when HTTP_REQUEST {
            if { [active_members [LB::server pool]] < 1} {
                    snat automap
                    SSL::disable serverside
                    HTTP::uri "/page1.aspx"
                    pool pool_sorry
            }
    }