HTTP::class

Description

Returns or sets the HTTP class selected by the HTTP selector.

Syntax

HTTP::class
HTTP::class [enable|disable]
HTTP::class [asm|wa]
HTTP::class select <name>

HTTP::class

  • Extracts the matching class name. If no class has been selected a null length string is returned.

HTTP::class [enable|disable]

  • Enables or disables the HTTP class selection process for the duration of the TCP connection or until the inverse command is called.

HTTP::class [asm|wa]

  • Returns true if an HTTP class with Application Security or Web Accelerator enabled has been selected.

HTTP::class select <name>

  • Selects an HTTP class. Note: the HTTP class must already be configured on the virtual server.

Examples

when HTTP_CLASS_SELECTED {
  if { [HTTP::class] eq $myHttpClass } {
    pool http
  }
}

when HTTP_CLASS_SELECTED {
   HTTP::class select $anotherHttpClass
}

when HTTP_REQUEST {

   log local0. "---------------------------------"
   log local0. "[IP::client_addr]:[TCP::client_port]: New [HTTP::method] request to [HTTP::host][HTTP::uri]"
   log local0. "[IP::client_addr]:[TCP::client_port]: Currently selected class: [HTTP::class], with ASM? [HTTP::class asm]"

   switch -glob [HTTP::uri] {
      "*1" {
         log local0. "[IP::client_addr]:[TCP::client_port]: Selecting httpclass1 for [HTTP::uri]"
         HTTP::class select httpclass1
      }
      "*2" {
         log local0. "[IP::client_addr]:[TCP::client_port]: Selecting httpclass2 for [HTTP::uri]"
         HTTP::class select httpclass2
      }
      default {
         log local0. "[IP::client_addr]:[TCP::client_port]: No HTTP class selected for [HTTP::uri]"
         HTTP::class disable
      }
   }
}
when HTTP_CLASS_SELECTED {
   log local0. "[IP::client_addr]:[TCP::client_port]: Currently selected class: [HTTP::class], with ASM? [HTTP::class asm]"
}

# Client request:
curl asm_vip/test[0-4]

Log output:
   <HTTP_REQUEST>: ---------------------------------
   <HTTP_REQUEST>: 1.1.1.1:1252: New GET request to asm_vip/test0
   <HTTP_REQUEST>: 1.1.1.1:1252: Currently selected class: , with ASM? 0
   <HTTP_REQUEST>: 1.1.1.1:1252: No HTTP class selected for /test0
   <HTTP_REQUEST>: ---------------------------------
   <HTTP_REQUEST>: 1.1.1.1:1252: New GET request to asm_vip/test1
   <HTTP_REQUEST>: 1.1.1.1:1252: Currently selected class: , with ASM? 0
   <HTTP_REQUEST>: 1.1.1.1:1252: Selecting httpclass1 for /test1
   <HTTP_CLASS_SELECTED>: 1.1.1.1:1252: Currently selected class: httpclass1, with ASM? 1
   <HTTP_REQUEST>: ---------------------------------
   <HTTP_REQUEST>: 1.1.1.1:1252: New GET request to asm_vip/test2
   <HTTP_REQUEST>: 1.1.1.1:1252: Currently selected class: , with ASM? 0
   <HTTP_REQUEST>: 1.1.1.1:1252: Selecting httpclass2 for /test2
   <HTTP_CLASS_SELECTED>: 1.1.1.1:1252: Currently selected class: httpclass2, with ASM? 1
   <HTTP_REQUEST>: ---------------------------------
   <HTTP_REQUEST>: 1.1.1.1:1252: New GET request to asm_vip/test3
   <HTTP_REQUEST>: 1.1.1.1:1252: Currently selected class: , with ASM? 0
   <HTTP_REQUEST>: 1.1.1.1:1252: No HTTP class selected for /test3