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 10, 2010For this I'd use 'findclass'. First, define a data group with your redirects via the gui (iRules->Data Group List->create, give it a name and then use type 'string'). Define a space-separated list of the domains like:
www.my.foo.com www.foo.com
Where the following rule should redirect you to the www.foo.com domain if they come in with www.my.foo.com:
when HTTP_REQUEST {
set Host [findclass [HTTP::host] your_datagroup_name " "]
if { $Host ne "" } {
HTTP::redirect $Host[HTTP::uri]
}
}
I've not tested the iRule above but it should get you very close. I'd add an else statement to handle hosts that don't match.
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