Forum Discussion

Ravi_Natarajan_'s avatar
Ravi_Natarajan_
Historic F5 Account
May 10, 2005

iRule varibles : per-connection based

I'm trying to write an iRule that has to maintain a set of variables for each TCP connection and has to include those variables as HTTP headers whenever they change.

 

 

In the following code, I'm expecting the variable BIGIP_SSL_CIPHER to be persistence per TCP connection; and it's initially passed to the server as HTTP header; and later on it'll be passed only when the value in the received HTTP req is different from the cached value.

 

 

when HTTP_REQUEST {

 

 

set sslVarModified 0

 

 

if { not [info exists BIGIP_SSL_CIPHER] } {

 

set BIGIP_SSL_CIPHER "[SSL::cipher name]"

 

set sslVarModified 1

 

}

 

 

if { [info exists BIGIP_SSL_CIPHER] and

 

[$BIGIP_SSL_CIPHER != [SSL::cipher name] } {

 

set BIGIP_SSL_CIPHER "[SSL::cipher name]"

 

set sslVarModified 1

 

}

 

 

 

if { $sslVarModified } {

 

 

HTTP::header replace "BIGIP_SSL_CIPHER" "\$BIGIP_SSL_CIPHER"

 

}

 

}

 

 

It is not working. What is wrong here ? Any help is greatly appreciated.

 

 

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    First of all, it's nearly impossible for us to tell what's wrong. Your iRule looks just fine.

     

     

    My suspicion is that you are actually dealing with a request on a different connection, as many browsers regularly spread requests over multiple connections. I would suggest adding a few log statements both to your HTTP_REQUEST event and to CLIENT_ACCEPTED and log the TCP/IP tuple so you can double check what's going on.