Sep 2026 - DevCentral is currently set to Read-Only (Sep 14th) for a platform update.
For some details see: DevCentral is Evolving.

Forum Discussion

F5-Hopeful's avatar
F5-Hopeful
Icon for Nimbostratus rankNimbostratus
Sep 27, 2019

Access local variable from a different Virtual Server

Is it possible to move a local variable between Virtual Servers without using a global variable or the session table. I have one tried to transfer it via the session table but as one Virtual Server is calling the second Virtual Server the variable is not in the session table when the second Virtual Server tries to get it.

1 Reply

Replies have been turned off for this discussion
  • Hello,

    Did you try this with sharedvar? https://clouddocs.f5.com/api/irules/sharedvar.html

    Example:

    # Applied on external layer vs
    when HTTP_REQUEST {
        sharedvar my_shared_var
        set my_shared_var "It was defined at [virtual name]"
     
        log local0. "Running: [virtual name]"
        log local0. " ${my_shared_var}"
        
        # Move to internal vs
        virtual vs_internal
    }
    # Applied on internal layer vs
    when HTTP_REQUEST {
        sharedvar my_shared_var
        
        log local0. "Running: [virtual name]"
        if { [info exists my_shared_var] } {
            log local0. " ${my_shared_var}"
        }
    }

    Regards.