Forum Discussion
gpoverland
Nimbostratus
Jul 08, 2008IRule that rewrites URI based on Pool or PoolMember Selected
I am trying to create an Irule that selects to rewrite a URI based on which pool member is chosen. Why you ask, well this is to accomodate the slow migration from an older application to a newer appli...
gpoverland
Nimbostratus
Jul 24, 2008nevermind,, figured it out...
when HTTP_REQUEST_SEND {
Save the URI to avoid running this command multiple times.
set uri [string tolower [clientside {HTTP::uri}]]
log local0. "[IP::client_addr]:[TCP::client_port]: \$uri: $uri"
log local0. "[IP::client_addr]:[TCP::client_port]: selected server details: [LB::server]"
Check if the selected server is .3 or .4
if {[IP::addr [LB::server addr] equals 10.207.225.101] or [IP::addr [LB::server addr] equals 10.207.225.102] or [IP::addr [LB::server addr] equals 10.207.225.103]} {
log local0. "[IP::client_addr]:[TCP::client_port]: matched server check for .3 or .4"
Check if the URI contains the first string
if {$uri contains "/gsfo/gsfopub"} {
Update the URI
clientside {HTTP::uri "/Async/CMReceive.ashx"}
log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/CMReceive.ashx"
Check if the URI contains the second URI
} elseif {$uri contains "/era/erapub" }{
Update the URI
clientside {HTTP::uri "/Async/ERAReceive.ashx"}
log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/ERAReceive.ashx"
Check if the URI contains the third URI
} elseif {$uri contains "/utilities/servconntest" }{
Update the URI
clientside {HTTP::uri "/Async/ServConnTest.ashx"}
log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/ServConnTest.ashx"
Check if the URI contains the Forth URI
} elseif {$uri contains "/leadseai/cmemailleadpub" }{
Update the URI
clientside {HTTP::uri "/Async/CMEmailLeadPub.ashx"}
log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/CMEmailLeadPub.ashx"
Check if the URI contains the Fifth URI
} elseif {$uri contains "/leadseai/salesleadpub" }{
Update the URI
clientside {HTTP::uri "/Async/SalesLeadPub.ashx"}
log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/SalesLeadPub.ashx"
} else {
Take some default action?
log local0. "[IP::client_addr]:[TCP::client_port]: didn't match URI checks"
}
}
}
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