Forum Discussion

Angelo_Iannaril's avatar
Angelo_Iannaril
Icon for Nimbostratus rankNimbostratus
Jan 28, 2007

HTTP_REQUEST and HTTP_RESPONSE iRule events

We would like to know why we get [SSL::sessionid] seems to always give us different results from within when HTTP_REQUEST and HTTP_RESPONSE iRule events.

 

We would also like to know whether a local variable initialised within HTTP_REQUEST would still be in scope in HTTP_RESPONSE. It appears to be, but we don't understand why. Please, could someone explain this to me?

 

  • Not sure about the session ID problem, but about your second question, local iRule variables have a scope of the instance of the iRule in which they are created, not the individual event handler. Therefore, a variable created in the HTTP_REQUEST event handler of an iRule instance will still be in scope when the HTTP_RESPONSE event for the same iRule instance gets called.

    If you like, you can use the unset statement to immediately clean up any variables once you're done with them. For example, to delete the variables myvar1, myvar2 and myvar3:

    unset -nocomplain myvar1 myvar2 myvar3

    -Leo

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Actually, local variable scope is to the connection, not the iRule instance.

     

     

    Variable values will traverse multiple events and multiple iRules applied to the same virtual server for the same connection unless unset.

     

     

    /deb