virtual

Description

Returns the name of the associated virtual server that the connection is flowing through. In 9.4.0 and higher, it can be also used to route the connection to another virtual server, without leaving the BIG-IP.

Warning

When using vip-targeting-vip configurations with mixed IP versions (for example, the first virtual server is IPv4, and the second is IPv6), the administrator is expected to ensure the proper address selection for packets leaving the first virtual server. The source address of the packet and the destination address of the packet have to belong to the same IP protocol. This can be achieved by using the source-address-translation and translate-address configuration options (or their iRule equivalents) on the first virtual server.

Syntax

virtual name
virtual [<name>]

virtual name

  • Return the name of the associated virtual server.

virtual <virtual server name>

  • Route the traffic to virtual server instead of normal server selection by load balancing.

Note: In version 9.4.0 and higher, virtual or virtual name returns the current virtual server’s name. In previous versions, only virtual name returns the current virtual server’s name.
Note: In version 9.4.0 and higher, ‘virtual ‘ can be used to route the connection to another virtual server, without leaving the BIG-IP. This functionality did not exist in previous versions. In order to make this functionality work, one must precede the virtual command with an LB::reselect command if a pool member has already been selected. Please review the LB::reselect command for more details, including which events this operation is valid in.
Note: In version 9.4.0 and higher, you can disable cmp on a virtual server. If you disable cmp on the post processing virtual server, ensure that the front virtual server is also cmp disabled.

Examples

when HTTP_REQUEST {
  log local0. "Current virtual server name: [virtual name]"
}

when HTTP_REQUEST {
  # Send request to a new virtual server
  virtual my_post_processing_server
}

# self-references are dangerous!
# If there's a chance you may assign to the same virtual, check before assignment.
when HTTP_REQUEST {
  if {[virtual name] ne "my_vs"} {
    virtual my_vs
  } else {
    log local0. "endless loop avoided"
  }
}

# if an LB pick has already occurred, use 'LB::reselect virtual' instead of just 'virtual'
when LB_SELECTED {
   if { [LB::server addr] eq '10.1.1.1' } {
      LB::reselect virtual vs-local-traffic-handler
   }
}