Forum Discussion

dragonflymr's avatar
dragonflymr
Icon for Cirrostratus rankCirrostratus
May 27, 2017

LB_SELECTED and HTTP commands - warning

Hi,

It took me off guard when doing some test with TCP profile. Be advised that under some conditions HTTP type commands may generate TCL error like that:

TCL error: /Common/host_change_member - Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::host"

It was caused by such code:

 

when LB_SELECTED {
    if { [LB::server addr] eq "10.128.30.110" } {
        set host "host1.test.com"       
    } else {
        set host "host2.test.com"
    }
    HTTP::header replace Host $host
}

 

Pretty safe code I guess, but...

If for some reason LB_SELECTED is triggered when no HTTP request is received, then mentioned error will be logged and of course connection will be reset.

I don't know other conditions causing this except:

In TCP profile enable Verified Accept

Above option seems to be rather dangerous for standard type VS (especially HTTP) as it breaks standard LB logic.

Instead of performing LB decision after successful client side 3WHS and first HTTP request received it performs LB after receiving SYN packet from client.

To avoid this problem it's better to perform HTTP related operations (that have to be based on some data collected during LB_SELECTED which is triggered after HTTP_REQUEST) in HTTP_REQUEST_RELEASE.

Piotr

4 Replies

  • Agree with your point. In above iRule LB_SELECTED works till selection but when you apply header replacement, it comes under HTTP related iRule method . That is the reason it will give error. thanks for posting your comments. I appreciate!!

     

  • Hi,

     

    Glad you found it helpful. I did benefit so many times from posts on the forum so I think is fair to contribute if possible.

     

    Piotr

     

  • Hi Piotr,

     

    There are 2 HTTP events in server side context :

     

    • HTTP_REQUEST_SEND
    • HTTP_REQUEST_RELEASE

    you can use both but some http commands are not supported in HTTP_REQUEST_RELEASE