Version notice:
ltm rule command sharedvarΒΆ
iRule(1) BIG-IP TMSH Manual iRule(1) sharedvar Allows a variable to be accessed in both sides of a VIP-targetting-VIP. SYNOPSIS sharedvar VARIABLE DESCRIPTION Allows a variable to be accessed in both sides of a VIP-targetting-VIP Syntax sharedvar* Shares a variable between both connections when a VIP targets another VIP. Note that both virtuals must declare the variable as shared for the data to be shared. RETURN VALUE VALID DURING ANY_EVENT EXAMPLES Virtual vip1: when HTTP_REQUEST { sharedvar public set private "data for vip1 only" set public "data for vip1 and vip2" virtual vip2 } when HTTP_RESPONSE { log local0. "vip1 @ response: private: $private" log local0. "vip1 @ response: public: $public" } Virtual vip2: when HTTP_REQUEST { sharedvar public if { [info exists private] } { log local0. "vip2 @ request: private: $private" } else { log local0. "vip2 @ request: private does not exist" } if { [info exists public] } { log local0. "vip2 @ request: public: $public" } else { log local0. "vip2 @ request: public does not exist" } } when HTTP_RESPONSE { set private "vip2 private data" set public "vip2 public data" log local0. "vip2 @ response: private: $private" log local0. "vip2 @ response: public: $public" } An HTTP request to VIP1 will log: Rule share2 : vip2 @ request: private does not exist Rule share2 : vip2 @ request: public: data for vip1 and vip2 Rule share2 : vip2 @ response: private: vip2 private data Rule share2 : vip2 @ response: public: vip2 public data Rule share1 : vip1 @ response: private: data for vip1 only Rule share1 : vip1 @ response: public: vip2 public data HINTS SEE ALSO CHANGE LOG @BIGIP-10.1.0 --First introduced the command. BIG-IP 2022-04-12 iRule(1)