What could you do with your code in 20 Lines or Less? That's the question I ask (sometimes?) every week for the DevCentral community, and every week I go looking to find cool new examples that show just how flexible and powerful iRules can be without getting in over your head.

This week the forums provide us with more examples of iRules wizardry (or at least apprentice awesomeness) in a scant 20 lines or less each. The credit goes to the awesome community for providing such frequent and awesome examples. This week's installation of iRules goodness in particular is brought to you by hoolio, who despite the snow storm (perhaps because of it?) was iRuling away like the mad man he is. Showing off how to simplify geographical based redirection, how to smoothly access a particular pool given the right configuration, and how to do some fancy matching to search for strings of digits.

Mobile Redirects


In this example user Ruchir is looking to do some matching based on some mobile device needs. They have a somewhat complex set of requirements to strip out a set of 4 or 6 digits from a URI that could take multiple forms. Making clever use of the URI::path depth command and some intelligence built into switch, Aaron shows that this can be near trivial if you know what knobs to turn.