Forum Discussion
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"
}
}
- uniAltostratusThere is nothing wrong with your rules, the problem must be with where you are implementing it. These rules will need to be assigned to an LTM virtual server. If you are assigning the rules to GTM pools the HTTP_REQUEST event will not be triggered. Could that be your problem?
- mike_kery_61561NimbostratusLOL - yes, I believe it is. Stepping back and thinking about it, the GTM is only DNS - it's just going to kick back the virtual server IP. Let me get this implemented on an LTM and point the GTM to it, and I can report back. Thanks for the help - i figured it was something dumb! :)
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com