Class match with starts_with - Data group matching order
Hello DevCentral,
I need your help today with very basic question which for some reason doesn't really makes senese for me.
I trying searched for such previously asked questions in the boards but couldn't find any.
I use a match class with starts_with operator to check the website url mathch against around 100 records of string based data groups key records - in order to determine the appropriate redirect to apply for this HTTP Requst - the value found inside the data group value.
Becasue of the starts_with operator I have a lot of situations where there are multiple keys inside the Datagroup that match the starts_with condition for the requsted URL.
For example I browse to: www.cnn.com/sports
inside my Datagroup I have both this records:
www.cnn.com -------> www.cnn.com/short
www.cnn.com/sports ------> www.cnn.com/long
in this case beacsue of the starts_with operator both these records match the requested HTTP URI.
I assume the F5 will chose in this case the first record showed inside the data group , this one:
"www.cnn.com -------> www.cnn.com/short"
But in practise after testing I see this is one who gets chosen is the most specfic one
"www.cnn.com/sports ------> www.cnn.com/long"
Meaning I get redirected to this final URL:
I'm not sure if I'm doing something wrong with my tests or if this is the accpted behavior , I couldn't find a clear answer for that.
I will appreciate your kind help with that,
Thanks in advance !
Kind regards,
Adir Z.
Bezeq International
It's "longest match". See https://clouddocs.f5.com/api/irules/class.html
---
Note: When using the equals operator on IP classes, or when using the starts_with or ends_with operators, if multiple possible matches are found in the class, then the longest match is always chosen. This is not true when using the contains operator. See the example below for more details.
---