F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

Gill_32697's avatar
Gill_32697
Icon for Nimbostratus rankNimbostratus
Dec 06, 2013

irule redirect by url.

I will be implementing the irule below, will it do what im needing, it did pass irule editor. what im needing to do is rediect to different pools based on the url header. We will have different public dns names assigned to the same public IP and then natted to the VIP. The iRule will redirect the to pool based on the url header. Our goal is to save IP's for some very small sites that are needed.

 

when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] { a-mysite.zcorp.com { pool a-mysite-pool } b-mysite.zcorp.com { pool b-mysite-pool }

 

c-mysite.zcorp.com { pool c-mysite-pool } b-mysite.zcorp.com { pool d-mysite-pool }

 

e-mysite.zcorp.com { pool e-mysite-pool }

 

default { reject } } }

 

1 Reply

  • You're technically correct, but I would put the switch conditions inside double quotes.

    when HTTP_REQUEST {     
        switch -glob [string tolower [HTTP::host]] { 
            "a-mysite.zcorp.com" {
                pool a-mysite-pool
            } 
            "b-mysite.zcorp.com" { 
                pool b-mysite-pool
            }
            "c-mysite.zcorp.com" {
                pool c-mysite-pool
            }
            "b-mysite.zcorp.com" {
                pool d-mysite-pool
            } 
            "e-mysite.zcorp.com" { 
                pool e-mysite-pool
            } 
            default {
                reject 
            } 
        } 
    }