Forum Discussion
How to Switch Between Pools using Irule
Original Irule:
==============================
when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]]
if {$http_uri equals "/" } { HTTP::redirect "https://kepogstest.jdadelivers.com/ikb" pool kepogstest.example.com-POOL return }
}
========================
Now one option of the application called floorplan is served by another server, so based on that we created a second pool named as : kepogstest.example.com-Floorplan-POOL.
Kindly assist in editing the Irule which will include the new created pool.
Thanks and Regards Parveez
3 Replies
- Philippe_CLOUP
Employee
I don't get why you send an HTTP::redirect to the client, but also send to the pool at the same time ? Usually, when you send to a pool member, you don't send and HTTP redirect at the same time. But i am probably missing something here. Anyhow, what you are looking for should be like this (replace /floorplan by what is required in term of URI for your application, same for your redirect):
when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]] if {$http_uri equals "/" } { HTTP::redirect "https://kepogstest.jdadelivers.com/ikb" pool kepogstest.example.com-POOL return } elseif {$http_uri equals "/Floorplan" } { HTTP::redirect "https://kepogstest.jdadelivers.com/Floorplan" pool kepogstest.example.com-Floorplan-POOL return} }
- Kevin_Stewart
Employee
Philou, I think your second condition may cause an infinite loop. If URI equals /floorplan, go to /floorplan. This issue, Parveez, is a matter of state. As Philou alludes, when a client makes a request (ingress) and the iRule responds with a redirect (egress), there is no further ingress and no traffic will get sent to a pool. Something like this may work instead:
when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri] if { $http_uri equals "/" } { HTTP::redirect "https://kepogstest.jdadelivers.com/ikb" } elseif { $http_uri starts_with "/ikb" } { pool kepogstest.example.com-POOL } } - Parveez_70209
Nimbostratus
Thank you Kevin Sir, your reply really helped a lot.
Regards Parveez
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