Forum Discussion
excluding specific uri from datagroup
Instead of starts_with go with equals.
That's a problem when have hundreds of URI's starting with /myweb/folder1/coronatime
- jaikumar_f5Nov 05, 2020MVP
Sorry I'm not following you, We are not going to use starts_with or contains, but be using equals. When equals condition is called it will look for exact match of the entire URI.
Can you tell how many you want to exclude from your original.
And yes you can still create a new DGL for exclusion and then use the return statement to break the flow on the current event.
- Abed_AL-RNov 05, 2020Cirrostratus
Sure let me explain again
So you have this DG: myweb_Uri_Data_group and it has URI starts with /myweb/folder1/coronatime . And your website has hundreds of URIs starting with /myweb/folder1/coronatime , and you have only one URI starts with /myweb/folder1/coronatime-xyz that you want to exclude from your DG.
So the only way I can think about is this way:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/myweb/folder1/coronatime-xyz } { return } if { [class match [string tolower [HTTP::uri]] starts_with myweb_Uri_Data_group] } { HTTP::redirect "[class match -value [string tolower [HTTP::uri]] starts_with myweb_Uri_Data_group]" } }
So my question: Is this the best solution or there is another best solution to exclude this specific URI ?
And another question - in general- should the "return' exits the entire irule or only the related "if" function?
Your suggestion regarding "equal" is not helping here .. because I have another hundreds of URIs starting with "/myweb/folder1/coronatime" such as:
/myweb/folder1/coronatime-memo
/myweb/folder1/coronatime-mamo
/myweb/folder1/coronatime-tatoo
etc etc ..
Thanks
- jaikumar_f5Nov 06, 2020MVP
Yes the above logic would work too. Basically when you call return, if would stop further processing on that event. Here its HTTP_REQUEST. But note this will stop for this Irule alone. If there's other Irule mapped to the VS, they will still function
There's multiple options you can go,
- Use if/elseif option. Whichever URI's you want to be excluded, you can create a new datagroup for that and call it in the 1st if condition. Whether you want to go with starts_with or equals is purely your design call. In that way, when 1st if is passed, further elseif wont be processed. When it not matches, it goes to elseif, and checks with the other DG you have, in your case myweb_Uri_Data_group.
- Yes you can use return to stop further process of this event as well.
Good luck.
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