Forum Discussion
Jeremyah_Corner
Nimbostratus
Apr 03, 2006Big Redirects List
I've got a lengthy list of redirs that I want to use F5 to do the work with, instead of a custom ASP solution that is running currently.
The basic gist..
I've got a list: ...
Jeremyah_Corner
Nimbostratus
Apr 03, 2006So, I've built two lists, a redirects, and a search list.. I'm asking find the pair based on the host address from the myRedirects list, then redirect, else (if the length of newdom is less than or equal to 1) find the third field of the host name (Based on the .) and find it in mySearchs lists then redirect to somesite in that list, else do a base redirect to a global search page.
Does this look right?
class myRedirects {
"site1.site.com site1a.site.com"
"site2.site.com site2.othersite.com"
"site3.othersite.com site1.site.com"
"site4.site.com site5.othersite.com\boo.asp"
"site3.site.com site5.othersite.com\woo.asp"
}
class mySearchs {
"uk site.co.uk/search.asp"
"jp site.co.jp/search.asp"
"tw site.com.tw/search.asp"
}
when HTTP_REQUEST {
set newDom [findclass [HTTP::host] $::myRedirects " "]
if { [string length $newDom] >= 1} {
HTTP::redirect $newDom
} else {
set myCatch [findclass [getfield HTTP::host] "." 3] $::MySearchs " "]
if { [string length $myCatch] >= 1} {
HTTP::redirect $myCatch
} else {
HTTP:redirect "http://mysearch.com"
}
}
}Oh, and another condition, since I've got a healthy ammount of www. CNAMEs, I'd like to exlude them from the list and just pick up the relivant part behind it..
when someone types in www.site1.site.com and it's CNAME'd the host still shows as www.site1.site.com and wouldn't match in this scenario, yes? How do I get around that? Woudl 'ends_with' be applicable in this 'host' scenario?
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