Forum Discussion
Feb 05, 2010
One Vs for Redirects
This should be an easy one..
I want to use one VS for a bunch of redirects, a catch all of sorts.. If for some reason this is a bad idea just let me know.
The redirect on...
L4L7_53191
Nimbostratus
Feb 05, 2010This will work fine. For manageability, I'd use a data group with your host names defined. Then you can simply matchclass against it (barely tested code below!):
when HTTP_REQUEST {
if { [matchclass [HTTP::host] equals dc-post] } {
log local0. "Got a match!"
HTTP::redirect http://[string map -nocase {"www" "my"} [HTTP::host]][HTTP::uri]
} else {
HTTP::respond 200 content " Sorry, no match "
}
}
Where the data group has 'www.foo.com', 'www.bar.com' or whatever domains you want.
HTH,
Matt
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