Forum Discussion
Irule to redirect traffic to particular pool
Hi,
I configured a VIP with pool. which is working fine.
Now there is business requirement is that to same VIP with different url should be redirect to different pool.
Below is the example
URL: https://studentportal.test.com/
Pool name: <POOL_StudentPortal>
URL: https://studentsportal.test.com/enrollment
Pool Name: <POOL_StudentEnroll>
Below is the irule I configured:
------------------------------------------------------
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/enrollment" }
{ pool POOL_StudentEnroll }
else {
pool POOL_StudentPortal
}
}
-----------------------------
For some reason, the above irule is not working.
Any help is highly appreciated.
Thanks.
- Sajid
Cirrostratus
Hi
My recommendation to use LTM policy, easy to configure and more efficient.
More
https://devcentral.f5.com/s/articles/inside-the-big-ip-simple-url-redirects-32269
K04597703: Overview of the Local Traffic Policies feature (12.1.0 and later)
https://support.f5.com/csp/article/K04597703
Local Traffic Policies Examples
Final Policy
- youssef1
Cumulonimbus
Hi Mohammed,
You irule is correct but you have to understand why your irule is not working.
In your case you have to enable Oneconnect profile in your VS. The problem is when you trigged another URL and you have to pass trough another pool it can not work because you have a connection attached to the intial pool. OneConnect allow to detach connection for each request:
https://support.f5.com/csp/article/K14239025
When OneConnect is enabled, the BIG-IP system maintains established connections to pool members. This allows the system to use established idle connections on the server side to load balance individual client requests from the same client-side connection. A server response tells the BIG-IP system to detach the client-side connection from the server-side connection. This allows the BIG-IP system to select another idle server-side connection to load balance a subsequent request from the client. The known issue prevents the BIG-IP system from detaching the client-side connection when it receives a server response other than an HTTP 200 status code. This disables request-based load balancing.
For this need the best solution is to used LTM Policy as describe by sajid. LTM policy is processed by request sor you will not have the problem that you meet.
So you have 2 alternatives:
- Enable default Oneconnect proflie on your VS
- use LTM policy instead irule
Let me know if you need more details
regards
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