Forum Discussion
Custom 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 using only one URL(which corresponds to old 7 servers). LB method is round robin. So when the request is sent to new version servers, the URL should be modified to reflect the correct path, this should happen only if the request sent to new version servers.
Thanks in Advance!!!
Raj
2 Replies
Hi Raj,
you may take a look to the snippet below...
It compares the currently selected node with the output of
(where the pool YOUR_NEW_APP_POOL contains just the new application servers). If the currently selected member can be found, then the[members -list YOUR_NEW_APP_POOL]
command can be used to change the request as needed...[clientside]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
Hi Raj,
The additional pool is just used as a container to make the administration easier. But you could also hardcode the new nodes into the iRule using this syntax...
when RULE_INIT { set static::new_app_nodes "1.1.1.1 443 2.2.2.2 443 3.3.3.3 443" } when HTTP_REQUEST_SEND { if { $static::new_app_nodes 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: Include possible route domain suffixes as needed^^
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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