Hi, ive done some searching on here but cannot find the exact help i need. We have the following scenario, can someone assist with an irule that will achieve this please?
we have one VIP that hostname site.abc.com resolves to, if user visits https://site.abc.com/live it should redirect to pool “pool_live” maintaining the uri “/live”. If user visits https://site.abc.com/test it should redirect to pool “pool_test” again maintaining the uri.
Another way would be with a Local Traffic Policy instead of an iRule. Under Local Traffic > Policies > Policy List, create a new policy. You’d need a rule in the policy like this for the first request:
Im sorry to move the goalposts but my brief has changed to the following now:
we have one VIP that hostname site.abc.com resolves to, if user visits https://site.abc.com/live it should redirect to pool “pool_live” changing the ur toi “/live_site”. If user visits https://site.abc.com/test it should redirect to pool “pool_test” changing the uri to /test_site.
To keep the rest of the path in place, use something like this. This will replace /live with /live_site and then remove the first 5 characters from the uri (so /live) and then insert the rest of the path
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/live"}{
HTTP::uri /live_site[string range [HTTP::uri] 5 end]
pool pool_live
} elseif {[HTTP::uri] starts_with "/test"}{
HTTP::uri /test_site[string range [HTTP::uri] 5 end]
pool pool_test
}
}