Forum Discussion
Daniel_104432
Sep 19, 2011Nimbostratus
How to read a string + value from a data group list
Hello there,
i've got some trouble with a datagroup list. We are using a lot of lists to match strings against client host requests but now I want to use the value of the matched string for a redirect destination.
So in detail i want to do something like this:
1. A client asks for bla.foobar.org
2. The Bigip is getting the request and is matching it against the data group list foobar_list.
3. The host matches and the bigip is doing a redirect to "www.foobar.org/bla"
class foobar_list {
"bla.foobar.org" { "www.foobar.org/bla" }
}
The reason I want to do it like this is to get away from one irule per redirect. We have way to much irules only for simple redirects. But I don't understand how to use the value.
I hope something like this is working:
if { [matchclass [HTTP::host] contains $::foobar_list] }
{
HTTP::respond 301 Location [vlaue of bla.foobar.org]
}
I only need to know how to get the value :)
thanks in advance.
- Michael_YatesNimbostratusHi Daniel,
class string_value_test_group { { "/foo" { "http://www.yahoo.com" } "/foofoo" { "http://www.google.com" } "/foofoofoo" { "http://www.msn.com" } } } when HTTP_REQUEST { set redirecturl [class match -value [string tolower [HTTP::uri]] starts_with string_value_test_group ] if { $redirecturl ne "" } { HTTP::respond 301 Location $redirecturl } }
- Daniel_104432NimbostratusThank you!
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