Forum Discussion

prabhat_73172's avatar
prabhat_73172
Icon for Nimbostratus rankNimbostratus
Jan 17, 2011

irule to read host from HTTP request and redirect

Hello,

 

I have BigIP LTM 10.0.1 system that sits in front of a http proxy gateway in the call path of incoming http requests in a ISP environment.

 

When customer access certain websites via proxy they experience errors. I'm trying to create an irule where it reads the host field on the http header and if it contains certain words (hotmail in this example), then it will direct the traffic via pool p1 (internet router) if not then via pool p2 (proxy gateway).

 

When I try to implement the irule I various errors. Below is the script.

 

Any assistance would be greatly appreciated.

 

 

 

when HTTP_REQUEST {

 

Specify current url

 

set host[HTTP::host]

 

 

Specify pools

 

 

set p1 "proxy_pool"

 

set p2 "internet_pool"

 

 

display current url and user agent in ltm log file

 

log "HOST = $host"

 

 

 

check if host has name that has issues going through proxy

 

switch -glob "$host" {

 

"*hotmail*" -

 

"*weather.com*" {

 

log "$host GOING TO Directly to $host -- 1.2"

 

pool $p2

 

} default {

 

log "$host GOING Through proxy-- 1.3"

 

pool $p1

 

}

 

}

 

end of switch