Forum Discussion
Redirect to another url and pool
I had set this up as two irule, the first irule is for the redirect to new URL alone and the second irule is to check the new URL header/ URI string match and send it to the new pool.
- socar65Apr 05, 2018Nimbostratus
Rajesh,
Thanks -- can you send me an example of that irule.
- Rajesh_261121Apr 05, 2018Nimbostratus
Here is the first one
when HTTP_REQUEST { if { [HTTP::host] eq "header.org" && [HTTP::uri] eq "/uri" } { HTTP::redirect "http://header2.org/newuri/"; } } Second one:
when HTTP_REQUEST { if { ([HTTP::host] eq "header2.org") && ( [HTTP::path] starts_with "/newuri") } { pool new-pool } }
- Stanislas_Piro2Apr 05, 2018Cumulonimbus
@Rajesh : This is the worst advice you can do.
when working with multiple irules, all irules are evaluated.
so even if the first irule matches, the second can be evaluated and may cause TCL error and TCP reset.
if irule 1 make a redirect for URI /uri and irule 2 add a HTTP header for all URI, there is a conflict which cause TCP reset (because HTTP insert command is not allowed if there is a redirect before).
- Rajesh_261121Apr 05, 2018Nimbostratus
@Stanislas.. Agree to you as we have to implement it without any conflict and i did in the past without any conflict...
Let me know if you can give an better solution for this in a single irule...
- lmiestc_26212Apr 05, 2018Cirrus
How about using the "event disable all" command. If you put that after the TCP::close. This will stop the current iRule processing and all subsequent iRules from processing
TCP::close event disable all return
See: https://devcentral.f5.com/wiki/iRules.event.ashx and here when it is used in an irule https://devcentral.f5.com/articles/irules-disabling-event-processing. Then my guess is you can use it in one irule.
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