cancel
Showing results for 
Search instead for 
Did you mean: 
Eric_Chen
F5 Employee
F5 Employee

Problem this snippet solves:

The associated iRule is used in the DevCentral article:

https://devcentral.f5.com/articles/connecting-docker-to-big-ip

This is a variation of https://devcentral.f5.com/articles/routing-http-by-request-headers

How to use this snippet:

Attach to virtual server. Expects two data groups exist: dg_docker_container and dg_docker_pool

Code :

when HTTP_REQUEST {
  set host_hdr [getfield [HTTP::host] ":" 1]
  set host_short [getfield $host_hdr "." 1]

  set node_addr [class match -value [string tolower $host_short] equals dg_docker_container]
  if { $node_addr ne "" } {
    node $node_addr
  } else {
    set pool_name [class match -value [string tolower $host_short] equals dg_docker_pool]
    if { $pool_name ne "" }
    {
      pool $pool_name
    } else {
    reject
    }
  }
}

Tested this on version:

11.5
Version history
Last update:
‎01-Sep-2015 16:38
Updated by:
Contributors