Forum Discussion

Yugandhar's avatar
Yugandhar
Icon for Nimbostratus rankNimbostratus
Mar 08, 2019

Variables used across Different Events

Hi,

 

Can we use the same variable in different events.

 

Here in the below iRule can we use the variables declared in the HTTP_REQUEST event also in the HTTP_RESPONSE event.

 

when HTTP_REQUEST

 

{

 

SET FLAG 1

 

SET CLIENT [IP::client_addr]

 

}

 

when HTTP_RESPONSE {

 

if {$FLAG} {

 

SET SERVER [IP::remote_addr]

 

log local0 10.10.10.10 "$CLIENT -- $SERVER"

 

}

 

}

 

Thanks,

 

Yugandhar.

 

1 Reply

  • Yugandhar,

     

    Local variables are connection based,http request and http response are of same connection, so yes they will have same values across events you are defining.

     

    You can go through Colin's variable articles if need be or irule wiki to know more about.