IRule to select Virtual server based on Incoming URI
Hello,
I am trying to setup an irule such that traffic based on certain URL's is directed towards the appropriate virtual servers. Essentialy we have mutliple URL's " siteA.domain.com" , "siteB.domain.com", "siteC.domain.com" and so on. What i want to do when the traffic comes in is that based on the incoming URL, i want the traffic to be sent to the VS defined for that site. I have a conceptual idea but when i put the rule in i get the error " command not valid in current scope"
The rule i tried is as below
when HTTP_REQUEST { if {[HTTP::uri] contains "siteA.domain.com" } { log local0. "SiteA Access" virtual vs_SiteA_prod } elseif {[HTTP::uri] contains "SiteB.domain.com" } { log local0. "SiteB Access" virtual vs_SiteB_prod } elseif {[HTTP::uri] contains "SiteC.domain.com" } { log local0. "SiteC Access" virtual vs_kronos_prod } elseif {[HTTP::uri] contains "SiteD.domain.com" } { log local0. "SiteD Access" virtual vs_SiteD_prod } else { log local0. "SiteA" virtual vs_SiteA_prod } } }
Any help would be appreciated.
Thanks,
karthik