Forum Discussion
iRule for directing traffic from a specific host and URI to a given pool
Hi, Guys. I need help for writing an iRule to send traffic from host1.internet.com with a URI request matching /uri1* to a pool pool1 Thank you in advance.
7 Replies
- Samir_Jha_52506
Noctilucent
use this irule.
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/uri1*" } { pool pool_X } }- Samir_Jha_52506
Noctilucent
Hope it will work.. try this. when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "host1.internet.com" and [string tolower [HTTP::host]] starts_with "/uri*" } { pool pool_x } }
- Vadim_96730
Nimbostratus
Hi, Samir. This appers to be a straight URI redirect to a pool. I am looking to also match the source of the request to a specific host, host1.internet.com. Thank you for your help. Vadim.
- arpydays
Nimbostratus
try this...
when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "host1.internet.com" } { if { [string tolower [HTTP::uri]] starts_with "/uri1" } { pool pool_X } } } - Stanislas_Piro2
Cumulonimbus
Hi,
if you are using version 11.4 or above, you can configure Local traffic policy instead of irule.
-
Policy
- require http
- controls forwarding
-
Rule 1 :
-
Condition
- http-host host equals host1.internet.com
- http-uri path starts_with /uri1
- Action forward pool Pool_X
-
Condition
-
Policy
- Vadim_96730
Nimbostratus
Arpydays, Entered your rule, and it passed F5 mustard. Will test in the morning but certainly makes sense and should work. Thank you very much.
Stanislas, I am running a BigIP version 10.2.4. Thank you as well.
Vadim.
- Stanislas_Piro2
Cumulonimbus
Hi,
in the irule, create a else statement with default pool assignment. if there is no default pool assignment, and the user browse first to /uri1 then to /uri2 in the same TCP connection, the second request will be assigned to the previous pool.
When CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "host1.internet.com" } { if { [string tolower [HTTP::uri]] starts_with "/uri1" } { pool pool_X } else { pool $default_pool} } }
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