Forum Discussion

Jérôme_ANGLES's avatar
Jérôme_ANGLES
Icon for Nimbostratus rankNimbostratus
Apr 23, 2012

reselect pool node based on http uri and status of the current selected node

Hi,

 

 

 

I have a problem creating an irules to force selection of another node based on the HTTP uri and the current selected node state.

 

 

 

I need this irules to help our developer to install new version of their application.

 

 

 

We are using cookie based persistence. Our node monitor is http based. If response is "200 OK" then the node is UP and if the response is "404" the node is session_disabled (only current active session continue to use this node until the session is finished.).

 

 

 

Everything work fine, but the problem is people that never terminate their session…

 

 

 

So, I need the irule to terminate the session and select another node when the user hit a specific uri (for example : login.php)

 

 

 

The actual irule that seems to work. I only can't find a way to reselect a node…

 

 

 

when HTTP_REQUEST {

 

if {[LB::status] == "session_disabled" && [HTTP::uri] == "/index.php"} {

 

 

}

 

}

 

 

 

I tried to use a variable and use its value in LB_SELECTED event

 

I tried to delete the cookie (HTTP::cookie remove "cookie_name")

 

I tried to end the sessions (session delete)

 

But nothing of those worked.

 

 

 

So, I decided to find a solution here…

 

  • have you tried node command?

     

     

    node wiki

     

    https://devcentral.f5.com/wiki/iRules.node.ashx
  • I think the node command will work, but it doesn't use the load balancing method.

     

     

    I know that the expression used in the if command work, i already put a log to inform me.

     

     

    The action i need in the if command is a new selection of a node in the pool based on the load balancing algorithm.
  • I have some some new informations about my problem.

    first, I saw that the LB::status command doesn't seem to work in the HTTP_REQUEST event. I put some log to see which node is select and there where no answer from the BigIP (null). The command was :

    log local0. "server info pool [LB::server pool] member [LB::server addr] port [LB::server port]"

    so i rebuilt my irule :

    when HTTP_REQUEST {
    set orig_uri [HTTP::uri]
    }
    when LB_SELECTED {
    if {[LB::status] == "session_disabled" && $orig_uri == "/test/test.php"} {
     just to be sure about the current selected node
    log local0. "server info pool [LB::server pool] member [LB::server addr] port [LB::server port]"
     now trying to select another node using the load balancing algorithm
    log local0. "LB reslect"
    LB::reselect
    }
    }
     

    The problem is still there, the LB::reselect command doesn't seems to work...

    If someone have an idea...

    Thanks,

    Jérôme