Forum Discussion
Tyranon_113005
Nimbostratus
Sep 18, 2018How iRule works when a persistence adapted?
I want the HTTP access depend on uri and IPaddress.(LTM version 11.5.1)
For specific client ipaddress(data group list CCclient), I want it access to poolB, others to poolA or 404 resopond.
But mayb...
Kevin_Stewart
Employee
Sep 18, 2018You maybe have some conflicting logic here. At the very least I'd suggest inserting some logging to see how things are really being handled.
when HTTP_REQUEST {
if { [HTTP::header exists "X-True-IP"] } {
set clientip [HTTP::header "X-True-IP"]
} else {
set clientip [IP::client_addr]
}
set uri [string tolower [HTTP::uri]]
if { $uri contains "/test.xml" } then {
if { ( [class match $clientip equals CCclient] ) } then {
log local0. "uri contains /text.xml - sending to pool B"
pool B
} else {
log local0. "sending 404 response"
HTTP::respond 404 content "404 File Not Found"
}
}
if { $uri contains "ref=trust" } {
log local0. "uri contains ref=trust - sending to pool B"
pool B
} else {
log local0. uri doesn't contain ref=trust - sending to pool A"
pool A
}
}
So basically, for it to go to pool B, the request URI has to contain "/test.xml" AND "ref=trust", and the IP has to be in the data group.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
