Forum Discussion
iRule to allow one of two URIs block all others
I am trying to create an iRule that will allow a URL that contains: /!portal/240100000001001 or /!portal/240100000001002 and blocks all other variations.
I have tried using a data group with iRule and can only manage to get it to block all URLs. Can anyone help? For the data group I have tried both the full URL and /!portal/240100000001001
class MCEP_allowed_URIs { "/system/templates/selfservice/sunburst/!portal/240100000001001" "/system/templates/selfservice/sunburst/!portal/240100000001002" }
when HTTP_REQUEST { if { [ class match [string tolower [HTTP::uri]] contains MCEP_allowed_URIs ] } { Stop processing the iRule for this event here return else { drop } } }
3 Replies
- What_Lies_Bene1
Cirrostratus
I wouldn't both with a data group if there are only two URIs involved. I'd use something like this. You can remove the logging once it tests out OK;
when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/system/templates/selfservice/sunburst/!portal/240100000001001" { Stop processing the iRule for this event here log local0. "Match on 240100000001001" return } "/system/templates/selfservice/sunburst/!portal/240100000001002" { Stop processing the iRule for this event here log local0. "Match on 240100000001002" return } "default" { drop } } }If you don't see a match, perhaps its to do with the
?! - JNeilson_117973
Nimbostratus
Thanks for the answer this worked
- What_Lies_Bene1
Cirrostratus
Great, you're welcome.
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