Forum Discussion
geffryti_32102
Nimbostratus
Mar 17, 2010how to use data group
Requirements:
1. system for redirecting certain host+uri to a different server (no pools)
2. use data group file to maintain uri-to-server list, so I can keep using the same irule for ot...
L4L7_53191
Nimbostratus
Mar 18, 2010Ok give this a try please:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
find a match using host+uri against the class and
returns the whole string (field1 field2 field3)then
set it as newURI variable.
set newURI "[findclass [HTTP::host][HTTP::uri] $::redlist]"
if { $newURI ne "" } {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched line $newURI"
Parse the three fields in the matched datagroup line
scan $newURI {%s %s %s} unused host uri
log local0. "Parsed: $unused $host $uri"
change host and uri
if {$host ne ""}{
log local0. "Setting new host to $host"
HTTP::header replace Host $host
}
if {$uri ne ""}{
log local0. "Setting new uri to $uri"
HTTP::uri $uri
}
}
}
-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