Redirect to different host and port based on URL
Hi
We just installed two F5 BigIP (LTM) devices so I am new to iRules, how would I setup the following redirect based on the incoming URL?
https://host.com/product1 redirect to https://host1.com:6500/product
https://host.com/product2 redirect to https://host2.com:6500/product
https://host.com/product3 redirect to https://host3.com:6500/product
https://host.com/product4 redirect to https://host4.com:6500/product
I was looking at doing the following for the URL rewrite but I am not sure how to get the hostname and port change part of the rewrite:
-----
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts with "/product1"}{
HTTP::uri [string map -nocase {product1 product} [HTTP::uri]]
}
if { [string tolower [HTTP::uri]] starts with "/product2"}{
HTTP::uri [string map -nocase {product2 product} [HTTP::uri]]
}
if { [string tolower [HTTP::uri]] starts with "/product3"}{
HTTP::uri [string map -nocase {product3 product} [HTTP::uri]]
}
if { [string tolower [HTTP::uri]] starts with "/product4"}{
HTTP::uri [string map -nocase {product4 product} [HTTP::uri]]
}
}
------
Thank you!
Mike