Forum Discussion
Alex_Pintel
Nov 22, 2022Nimbostratus
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...
- 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
Alex_Pintel
Nimbostratus
Thank you all for responding to my post. I have another question.
What would be right syntax if I need to use 2 URLs?
if { [HTTP::path] ne "/abc/Web123/cde/forum123" OR "/abc/Web123/cde/forum456"
Is the "OR" correct operator?
Thank you!
Amine_Kadimi
Nov 24, 2022MVP
For the requested logic, you need the "and" operator between two tests:
if { ([HTTP::path] ne "/abc/Web123/cde/forum123") and ([HTTP::path] ne "/abc/Web123/cde/forum456") }
If you plan to add more paths in the future, then consider using a switch test
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects