Forum Discussion

Mike_Kriwonos_3's avatar
Mike_Kriwonos_3
Icon for Nimbostratus rankNimbostratus
Feb 07, 2019

How to create Policy rul to match HTTP::URI path contains

Policy HTTP URI match

 

3 Replies

  • To clarify, are you asking about creating an iRule or about creating an LTM policy, which should be based on a specific uri?

     

  • Local Traffic > Policies > Create

     

    Give it a name, click create.

     

    Then add a Rule to it, which has HTTP URI selected in the first drop down box, path selected in the second box, and contains in the third box.

     

    You can select what happens when your criteria are met in the field below that.

     

    Hope that helps! If it does please up-vote and select this answer, it'd be greatly appreciated!

     

    -Dylan

     

  • Sorry, but it was not my intention to submit this question without context. My goal is to check the URI to see if it contains "logout", but does NOT include "service". This would make it a default Service Logout if NO specific logout service is specified. I have a working iRule (included below) and I tried to recreate it with a Traffic policy. The policy causes a "Too many redirects" error. It seems like I am misunderstanding the logic or the parameters used in the policy conditions, but I cannot figure out how.

     

    Here are the details: Below I included my existing iRule, which seems to work fine. when I visit "; it does a single redirect to my desired logout endpoint

     

    when HTTP_REQUEST { if { ( [HTTP::uri] contains "logout" ) and !( [HTTP::uri] contains "service" ) } { HTTP::redirect "https://mycasserver.com/cas/logout?service=https://federatedhost.com/common/wsfederation?wa=wsignout1.0"; }

     

    I reviewed the policy manual here: https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/local-traffic-policies-getting-started-12-1-0/1.html

     

    I created a policy and when I trace the headers it keeps redirecting repeatedly until the redirect threshold is reached and error ensues. Below is my policy: