aFleX to send traffic to a multiple pool based on the hostname and redirect to U
How to send the traffic to multiple pools based on hostname and redirect URI to path
I am trying below script but it is not working. Can some one tell me working script.
when HTTP_REQUEST {
if {[HTTP::host] matches "abc.in" and not ([HTTP::uri] starts_with "/abc-api") } {
HTTP::redirect "http://abc.in/abc-api/login"
pool abc_in
} elseif {[HTTP::host] matches "www.abc.in" and not ([HTTP::uri] starts_with "/wwwabc-api") } {
HTTP::redirect "http://www.abc.in/wwwabc-api/login"
pool www_abc_in
} elseif {[HTTP::host] matches "admin.abc.in" and not ([HTTP::uri] starts_with "/admin") } {
HTTP::redirect "http://admin.abc.in/admin/sign_in.php"
pool admin_abc_in
}
I am trying below script but it is not working. Can some one tell me working script.
when HTTP_REQUEST {
if {[HTTP::host] matches "abc.in" and not ([HTTP::uri] starts_with "/abc-api") } {
HTTP::redirect "http://abc.in/abc-api/login"
pool abc_in
} elseif {[HTTP::host] matches "www.abc.in" and not ([HTTP::uri] starts_with "/wwwabc-api") } {
HTTP::redirect "http://www.abc.in/wwwabc-api/login"
pool www_abc_in
} elseif {[HTTP::host] matches "admin.abc.in" and not ([HTTP::uri] starts_with "/admin") } {
HTTP::redirect "http://admin.abc.in/admin/sign_in.php"
pool admin_abc_in
}
0
Comments
As i mentioned in the aflex script
when HTTP_REQUEST {
set host [HTTP::host]
if { $host matches "abc.in" } {
pool "abc_in"
} elseif { $host matches "www.abc.in" } {
pool "www_abc_in"
} elseif { $host matches "admin.abc.in"} {
pool "admin_abc_in"
}
}
when HTTP_REQUEST {
if {[HTTP::host] matches “abc.in” and not ([HTTP::uri] starts_with “/abc-api”) } {
HTTP::redirect “http://abc.in/abc-api/login”
} elseif {[HTTP::host] matches “www.abc.in” and not ([HTTP::uri] starts_with “/wwwabc-api”) } {
HTTP::redirect “http://www.abc.in/wwwabc-api/login”
} elseif {[HTTP::host] matches “admin.abc.in” and not ([HTTP::uri] starts_with “/admin”) } {
HTTP::redirect “http://admin.abc.in/admin/sign_in.php”
}
}