Forum Discussion
Narendra_26827
Jul 14, 2011Nimbostratus
iRule for redirecting requests
Hi, We have vip on port 80 with default pool having all members(on different ip addresses) on port 80. Now we have requirement like this when following HTTP::uri comes on this ...
Narendra_26827
Jul 15, 2011Nimbostratus
I was to able to achieve the desired result for above scenario with IP Persistence and match across services. Thanks for the help.
Now i want to have an iRule for if any redirect comes from any subsystem service member then all the other subsequent requests of other subsystem services should be moved to other ip address (breaking IP persistence). For say suppose i access the application from port 80 one member is selected from the default pool (i.e. either 192.168.159.133:80 or 192.168.159.134:80). Now if 192.168.159.133:80 is selected subsystem requests will be going to 192.168.159.133:8087,8088 & 8089 with IP persistence and match across profile. Now suppose if 192.168.159:133:8087 subsystem sends a http 307 temporary redirect then the requests of all 192.168.159.133:80, 8088 & 8089 should be moved to new node i.e. like 192.168.159.134:80, 8087, 8088 & 8089 breaking source address affinity.
I have created and iRule like below but it doesn't seems to work.
when CLIENT_ACCEPTED {
set retries 0
}
when HTTP_REQUEST {
set request [HTTP::request]
set uri [HTTP::uri]
switch -glob [string tolower $uri] {
"/api/channel*" { pool channel-pool }
"/api/space*" { pool space-pool }
"/api/gateway*" { pool gateway-pool }
default { pool default_pool }
}
}
when LB_SELECTED {
if { $retries > 0 } {
persist none
switch -glob [string tolower $uri] {
"/api/channel*" { LB::reselect pool channel-pool member 192.168.159.134 8088 }
"/api/space*" { LB::reselect pool space-pool member 192.168.159.134 8089 }
"/api/gateway*" { LB::reselect pool gateway-pool member 192.168.159.134 8087 }
default { LB::reselect pool default_pool member 192.168.159.134 80 }
}
}
}
when HTTP_RESPONSE {
switch [HTTP::status] {
307 {
incr retries
persist none
HTTP::retry $request
}
}
}
Can anybody help me on the above ?
Thanks.
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