Forum Discussion
Gilles_Archer_3
Nimbostratus
Sep 30, 2013How to redirect user to URL based on entered CNAME
I apologize if this has been asked and answered in the past, but I'm not sure which keywords I should be using to find what I'm looking for.
What I'm trying to do is when a user enters 'service-...
Kevin_Stewart
Employee
Oct 01, 2013Just a thought, but the first issue is generally resolved with a CNAME. I don't believe GTM can natively issue a CNAME from a given short name, so an iRule like this (applied to the LTM listener VIP) could work. This is a very simple example, so I'm sure there's a better way.
when DNS_REQUEST {
switch [string tolower [DNS::question name]] {
"service-a" {
DNS::answer insert "service-a CNAME service-a.company.com"
DNS::return
}
"service-b" {
DNS::answer insert "service-b CNAME service-b.company.com"
DNS::return
}
}
}
Where "service-a.company.com" and "service-b.company.com" resolve to the same virtual server IP. Then use an iRule on the VIP that validates the Host header:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "service-b.company.com" } {
HTTP::redirect "http://service-a.company.com/service-b"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects