Forum Discussion
iRule for URL redirection to a pool
Hi Guys,
I’m new to iRule, can someone help with creating iRule for my requirement.
I have two URLs for PROD and DEV with same host name. I want to point PROD traffic to pool A and DEV traffic to pool B
https://abc.example.com/app/prod/zsedrcftg ==>pool A https://abc.example.com/app/dev/aserdftgy ==> pool B
I want to point based on /app/prod/* & /app/dev/*
- jaikumar_f5
Noctilucent
Edited after Stan's comment: Updated with starts_with, had missed -glob (added now)
Use any one of the below,
If else condition,
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/app/prod/" } { pool Prod_Pool } else { pool Dev_Pool } }
Using switch,
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/app/prod/*" { pool Prod_Pool } "/app/dev/*" { pool Dev_Pool } } }
- Dan_Pacheco
Cirrus
Lots of posts with examples on how to do this, here is one: https://devcentral.f5.com/questions/irule-to-select-pool-based-on-url
In addition to the advice above, also consider ‘string tolower’ since irules are case sensitive. And what do you want to happen if there is no match in the irule. If there is no match the f5 will send traffic to the default pool assign in the vs.
- Koti_Reddy_Kol1
Nimbostratus
Thanks Jaykumar, Piron, and Dan for your response. I will try the options given to me.
- Koti_Reddy_Kol1
Nimbostratus
Finally it's working, thanks all for your help.
Lots of posts with examples on how to do this, here is one: https://devcentral.f5.com/questions/irule-to-select-pool-based-on-url
In addition to the advice above, also consider ‘string tolower’ since irules are case sensitive. And what do you want to happen if there is no match in the irule. If there is no match the f5 will send traffic to the default pool assign in the vs.
- Koti_Reddy_Kol1
Nimbostratus
Thanks Jaykumar, Piron, and Dan for your response. I will try the options given to me.
- Koti_Reddy_Kol1
Nimbostratus
Finally it's working, thanks all for your help.
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