HTTP::redirect for "vanity" URLs?
I have what I think is a simple http::redirect request, but cannot seem to craft an iRule that works... Here's the idea - I'd like any request to a particular wideip (say, HTTP_REQUEST to gtmfoo.wideip.company.com) to be redirected to a different URL. The goal is to create "vanity" dns entries that the GTM can return a specific URL for. So, I can create a CNAME for "gtmfoo" that points to FQDN gtmfoo.wideip.company.com. Upon getting an http request to this wideip, a redirect is sent back with a particular URL, say http://support.f5.com/kb/en-us...wbr>.
The net effect - user types "gtmfoo" into their browser and and gets sent to http://support.f5.com/kb/en-us...wbr>.
This seems like a relatively straightforward thing, but I cannot seem to put together anything that works. Below are a few attempts I've tried based on things I've cobbled together in the forums - where am I going wrong? Thanks in advance for any help you can spare - still getting the hang of my iRules...
ATTEMPT 1:
when HTTP_REQUEST {
HTTP::redirect "http://support.f5.com/kb/en-us...wbr>"
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting request"
}
ATTEMPT 2:
when HTTP_REQUEST {
if { [HTTP::host] contains "gtmfoo"} {
HTTP::redirect "http://support.f5.com/kb/en-us...wbr>"
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting request"
}
}
ATTEMPT 3:
when HTTP_REQUEST {
if { [http::path] contains "gtmfoo" } {
http::redirect location "http://support.f5.com/kb/en-us...wbr>"
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting request"
}
}