Forum Discussion

ashok_102425's avatar
ashok_102425
Icon for Nimbostratus rankNimbostratus
Feb 10, 2014

Pool selection based on header

Dear All,

 

I am using irules and selecting pools based on header name.

 

For example if the header is http://mail.sunrise.com go to pool example

 

if the header is http://sunrise.com go to pool sunrise.

 

The above scenario works fine

 

now the challenge is i need to allow only one country UK to mail.sunrise.com

 

united states & india to www.sunrise.com

 

thanks in advance

 

Regards

 

3 Replies

  • Vitaliy is right on the money I think. The following isn't perfect, but should get you in the right direction.

    when HTTP_REQUEST {
    
        set whereis [whereis [IP::client_addr] country]
    
        switch [string tolower [HTTP::host]] {
            "mail.sunrise.com" {
                if { $whereis equals "GB" } {
                    pool example
                } else {
                    HTTP::redirect "http://sunrise.com"
                }
            }
            "www.sunrise.com" -
            "sunrise.com" {
                if { ( $whereis equals "US" ) or ($whereis equals "IN" ) } {
                    pool sunrise
                } else {
                    drop
                }
            }
        }
    }