Forum Discussion

Simon_Ferrett_8's avatar
Simon_Ferrett_8
Icon for Nimbostratus rankNimbostratus
Jun 19, 2008

LB::reselect not valid in LB_SELECTED context?

Hi,

 

 

I'm trying to have an iRule that sets a HTTP header in the request which contains the host:port of the selected server that the request would be sent to, and then send the request to a different pool.

 

 

eg:

 

 

when LB_SELECTED

 

{

 

if {[LB::server pool] contains "somepool"} {

 

HTTP::header replace X-Pool "[LB::server addr]:[LB::server port]"

 

pool otherpool

 

LB::reselect pool otherpool

 

}

 

 

I have a couple of issues...

 

 

The first is that [LB::server addr] and [LB::server port] both seem to return empty (my header is set to ":") which is odd. I thought they would contain the selected server from the pool about to be used. I tried putting a LB::reselect before the header replace to maybe kickstart it into having selected a server but that ran me into my second issue which is..

 

 

I get this error when I go to save the iRule:

 

line 60: [command is not valid in current event context (LB_SELECTED)] [LB::reselect]

 

 

This occurs regardless of whether I put "pool otherpool" or not as arguments to LB::reselect.

 

 

All the docs I can find say that reselect should be valid in the LB_SELECTED phase, but the above error suggests otherwise.

 

 

I'm running BIG-IP 9.1.1 Build 54.6 so maybe I'm on an old rev or something?

 

 

Also should LB::server addr and port be defined at that time? I tried them in the HTTP_REQUEST event also but they seem to be empty there too.

 

 

It's very possible I'm just doing something completely dumb.. to this point most of the rules I have are very basic ones.

 

 

Thanks for any assistance -

 

 

Simon.

 

 

 

1 Reply

  • spark_86682's avatar
    spark_86682
    Historic F5 Account
    Yes, you're definitely on an old revision. LB::reselect is available in LB_SELECTED starting in v9.2.0. I would recommend upgrading to the latest 9.3.x release (9.3.1, IIRC).