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: ...
Colin_Walker_12
Apr 03, 2006Historic F5 Account
Hoolio's right on on this one.
The findclass command lets you specify a seperator and will return the resultant second half of the string in the class.
For instance, the class in question:
class myRedirects {
"site1 site1a"
"site2 site1a"
"site3 site1a"
"site4 site2a"
"site5 site2b"
"site6 site3b\widget.htm"
"site7 site2b\widget.asp"
}combined with a findclass statement such as:
[findclass [HTTP::host] $::myRedirects " "]Would return site1a or site2a, etc. depending on which hostname was used. This is, of course, assuming that "site1" is the entire hostname of the site. If you're trying to use just the first portion, the canonical name for instance, then you'd want to make use of the getfield command, as well.
That would look something like this:
[findclass [getfield [HTTP::host] "." 1] $::myRedirects " "] To put that into the context of your rule, it'd look like:
when HTTP_REQUEST {
set newDom [findclass [getfield [HTTP::host] "." 1] $::myRedirects " "]
if { [string length $newDom] >= 1 } {
HTTP::redirect $newDom
} else {
HTTP::redirect "http://othersite.com/search.asp"
}
}Hopefully that at least gets you pointed in the right direction.
-Colin
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