Forum Discussion

Alex_Pintel's avatar
Alex_Pintel
Icon for Nimbostratus rankNimbostratus
Nov 22, 2022

iRule exclude URI

I am fairly new to iRules so any help greately appreciated. What is correct syntax to exclude URI "/abc/Web123/cde/forum123/ from receiving HTTP code 200 and the message "123456789"? Is the exclamat...
  • Amine_Kadimi's avatar
    Nov 23, 2022

    To negate starts_with I would use the not operator:

    https://clouddocs.f5.com/api/irules/not.html

    when HTTP_REQUEST {
      if { not ([HTTP::uri] starts_with "/abc") } {
         # do something ...
      } else {
         # do something else...
     }
    }

    For excluding the exact path, you can go with  the "ne" operator