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 11, 2010The following rule works for me - note: I'm using version 10.1 for this testing. What version are you using? I ask because the way we reference data groups has changed and that may be affecting you.
Step 1: I created a data group called 'dc-post' and added two entries - note that I left the 'value' field blank.
"www.foo.com www.google.com"
"www.bar.com www.yahoo.com"
when HTTP_REQUEST {
set Host [findclass [HTTP::host] dc-post " "]
log local0. "Host var is $Host"
if { $Host ne "" } {
HTTP::redirect http://$Host[HTTP::uri]
}
}
Note that there's one change to the rule above: I added the 'http://' to the redirect. It'll work either way, but my original rule was confusing (for it to work you'd need to specify 'http://www.foo.com' in your data group for the first field as opposed to just the hostname). Sorry for the confusion on that.
At any rate, this appears to be working fine. Please let me know if you still have problems.
-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