Forum Discussion
raj_77723
Nimbostratus
Feb 14, 2016Custom iRule for URL rewrite for specific pool members
Requirement is
Virtual mapped with pool of 10 App servers. out of 10, 7 servers running with old version and 3 servers with new version. but the URL differs with server version. client will be ...
Kai_Wilke
MVP
Feb 15, 2016Hi Raj,
you may take a look to the snippet below...
It compares the currently selected node with the output of
[members -list YOUR_NEW_APP_POOL] (where the pool YOUR_NEW_APP_POOL contains just the new application servers). If the currently selected member can be found, then the [clientside] command can be used to change the request as needed...
when RULE_INIT {
set static::new_app_pool "/Common/YOUR_NEW_APP_POOL"
}
when HTTP_REQUEST_SEND {
if { [members -list $static::new_app_pool] contains "[LB::server addr] [LB::server port]" } then {
log -noname local0.debug "Match! [members -list $static::new_app_pool] contains [LB::server addr] [LB::server port]"
clientside {
Rewrite the request as needed...
}
} else {
log -noname local0.debug "Don't match! [members -list $static::new_app_pool] contains [LB::server addr] [LB::server port]"
}
}
Note: The pool YOUR_NEW_APP_POOL is just used to identify the new application servers. Its not used for LB or forwarding the traffic.
Cheers, Kai
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