<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>DevCentral</title>
        <link>http://devcentral.f5.com/weblogs/cwalker/category/69.aspx</link>
        <description>DevCentral</description>
        <language>en-US</language>
        <copyright>Colin Walker</copyright>
        <managingEditor>c.walker@f5.com</managingEditor>
        <generator>Subtext Version 1.9.5.176</generator>
        <item>
            <title>20 Lines or Less #15</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/10/08/20-lines-or-less-15.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;What could you do with your code in 20 Lines or Less?&lt;/em&gt; That's the question I ask every week, 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.&lt;/p&gt;  &lt;p&gt;Finally back into the swing of the 20LoL, I'm happy to give you the 15th edition of this blog series. Today's offering is brought to you by me, F5, and the power of iRules (tm).  Okay, not really (tm), but it sounded cool.  I still find myself on a journey to seek out the coolest iRule tidbits that I can in hopes of bringing them to you and showing off just how much power you can pack into a minute amount of code in an iRule. This week's examples are nothing less than that, and hopefully you'll find at least one interesting, if not useful.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Advanced URI Rewriting&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28429&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28429&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28429&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this example of rewriting a URI we go well past a simple directory change or query rewrite. This example goes a little further into the realm of the possible to show you how to rewrite a UID that is a portion of a complex URI. Thanks to hoolio and the other iRulers that contributed.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;when RULE_INIT {        &lt;br /&gt;   # Set a couple of test query strings         &lt;br /&gt;   #set source {a=123&amp;amp;k=456&amp;amp;uid=toto&amp;amp;h=789}         &lt;br /&gt;   #set source {uid=toto&amp;amp;a=123&amp;amp;k=456&amp;amp;h=789}         &lt;br /&gt;   set source {a=123&amp;amp;k=456&amp;amp;h=789&amp;amp;uid=toto}         &lt;br /&gt;   # Split the string into a list on the delimiter &amp;amp;         &lt;br /&gt;   log local0. "\[split \$source\ &amp;amp;]: [split $source &amp;amp;]"         &lt;br /&gt;   # Create a new query string         &lt;br /&gt;   set new_query_string ""         &lt;br /&gt;   # Loop through the list and create an array of parameters and values         &lt;br /&gt;   foreach param_value_pair [split $source &amp;amp;] {         &lt;br /&gt;      log local0. "\$param_value_pair: $param_value_pair"         &lt;br /&gt;      # If the current param value pair starts with uid=, then prepend it to the list of query string parameters         &lt;br /&gt;      if {$param_value_pair starts_with "uid="}{         &lt;br /&gt;         set new_query_string ${param_value_pair}${new_query_string}         &lt;br /&gt;      } else {         &lt;br /&gt;         set new_query_string ${new_query_string}&amp;amp;${param_value_pair}         &lt;br /&gt;      }         &lt;br /&gt;      log local0. "\$new_query_string: $new_query_string"         &lt;br /&gt;   }         &lt;br /&gt;   set new_query_string hxs=1&amp;amp;${new_query_string}         &lt;br /&gt;   log local0. "\$new_query_string: $new_query_string"         &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;HTTP to HTTPS redirect on 401&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28235&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28235&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28235&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This iRule is built for a very specific deployment scenario which displays some ... interesting behaviors.  The requirement was to redirect back to the proper HTTPS URL for the site if authorization was required. This is done to ensure that things are secure where they need to be before allowing people to enter auth information.  I know it's not the most straight-forward way of doing things, but this particular deployment didn't have another workaround, so iRules came to the rescue.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST {        &lt;br /&gt;   set host [HTTP::host]         &lt;br /&gt;   set uri [HTTP::uri]         &lt;br /&gt;}         &lt;br /&gt;when HTTP_RESPONSE {         &lt;br /&gt;   if {[HTTP::status] == 401]}{         &lt;br /&gt;      HTTP::redirect "&lt;/font&gt;&lt;a href="https://$host/"&gt;&lt;font face="courier new"&gt;https://$host/&lt;/font&gt;&lt;/a&gt;&lt;font face="courier new"&gt;$uri"        &lt;br /&gt;   }         &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;font face="courier new"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Multi-Host HTTP Redirection with Switch&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28200&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28200&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=28200&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This example is a slightly trimmed version of the one provided (by hoolio, yet again) in the forum post. It shows some great ways to use a single switch to match many different domains or partial domains when doing a redirect based on a host. The individual pieces are all pretty straight-forward, but it's a great example of how to build a single, elegant logic flow rather than a bulkier if/else chain.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST {        &lt;br /&gt;   log local0. "[IP::client_addr]:[TCP::client_port]: New HTTP request to [HTTP::host][HTTP::uri]"         &lt;br /&gt;   switch -glob [string tolower [HTTP::host]] {         &lt;br /&gt;      "*newlifepubs.com" {         &lt;br /&gt;         log local0. "[IP::client_addr]:[TCP::client_port]: Matched 1"         &lt;br /&gt;         HTTP::redirect "&lt;/font&gt;&lt;a href="http://www.example.com/nlp" ?="?"&gt;&lt;font face="courier new"&gt;http://www.example.com/nlp"&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;&lt;font face="courier new"&gt;      }        &lt;br /&gt;      "*mpd.example.org" {         &lt;br /&gt;         log local0. "[IP::client_addr]:[TCP::client_port]: Matched 2"         &lt;br /&gt;         HTTP::redirect "&lt;/font&gt;&lt;a href="http://staffweb.example.org/mpd/index.aspx" ?="?"&gt;&lt;font face="courier new"&gt;http://staffweb.example.org/mpd/index.aspx"&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;&lt;font face="courier new"&gt;      }        &lt;br /&gt;      "staff.example.org" {         &lt;br /&gt;         HTTP::redirect "&lt;/font&gt;&lt;a href="http://staffweb.example.org/" ?="?"&gt;&lt;font face="courier new"&gt;http://staffweb.example.org/"&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;&lt;font face="courier new"&gt;      }        &lt;br /&gt;      "*movementseverywhere.example.com" {         &lt;br /&gt;         HTTP::redirect "&lt;/font&gt;&lt;a href="http://www.example.org/" ?="?"&gt;&lt;font face="courier new"&gt;http://www.example.org/"&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;&lt;font face="courier new"&gt;      }        &lt;br /&gt;      default {         &lt;br /&gt;         log local0. "[IP::client_addr]:[TCP::client_port]: No match"         &lt;br /&gt;         discard         &lt;br /&gt;      }         &lt;br /&gt;   }         &lt;br /&gt;}&lt;/font&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;There's another 20LoL for your coding pleasure. Hopefully I've been able to fuel your desire to run out and whip up some awesome iRules yourself. Check back next week for more cool code!&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2cd66c38-08bc-4ed4-9bbc-6b95a55059db" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/20%20Lines%20or%20Less" rel="tag"&gt;20 Lines or Less&lt;/a&gt;,&lt;a href="http://technorati.com/tags/HTTP%20Redirect" rel="tag"&gt;HTTP Redirect&lt;/a&gt;,&lt;a href="http://technorati.com/tags/401%20Auth%20Required" rel="tag"&gt;401 Auth Required&lt;/a&gt;,&lt;a href="http://technorati.com/tags/HTTPS%20redirect" rel="tag"&gt;HTTPS redirect&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3698.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/10/08/20-lines-or-less-15.aspx</guid>
            <pubDate>Thu, 09 Oct 2008 00:29:05 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3698.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/10/08/20-lines-or-less-15.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3698.aspx</wfw:commentRss>
        </item>
        <item>
            <title>A Groundswell of support...</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/09/12/a-groundswell-of-support.aspx</link>
            <description>&lt;p&gt;&lt;img style="margin: 0px 0px 20px 35px" src="http://www.forrester.com/groundswell/images/groundswell_title.jpg" align="right" /&gt;If you've &lt;a href="http://devcentral.f5.com/weblogs/dcpodcast/archive/2008/09/11/3608.aspx" target="_blank"&gt;listened to the podcast this week&lt;/a&gt;, or &lt;a href="http://devcentral.f5.com/weblogs/dmacvittie/archive/2008/09/09/3601.aspx" target="_blank"&gt;seen the blogs&lt;/a&gt;, or haven't been hiding under a rock, then you've heard that we here at &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; have &lt;a href="http://www.forrester.com/Groundswell/supporting/devcentral.html" target="_blank"&gt;entered our community into Forrester's Groundswell awards&lt;/a&gt;.  We're very excited to be able to add our hat to the ring, as it were, and it's really thanks to all of you out there in DCLand. &lt;/p&gt;  &lt;p&gt;We've entered in the "&lt;a href="http://www.forrester.com/Groundswell/supporting/devcentral.html" target="_blank"&gt;Supporting&lt;/a&gt;"  category, and that's really all about how much the awesome community we get to be a part of is out there helping each other every day.  The direct quote is "&lt;strong&gt;SUPPORTING.&lt;/strong&gt; Help customers support each other to solve each other's problems."  If that isn't DC to a T, then I don't know what is.&lt;/p&gt;  &lt;p&gt;I'm blown away every single day as we get more and more new users, more posts to the forums, more wiki updates, and more questions being asked just about everywhere...and yet the community keeps stepping up to the plate, and helping out where needed.  There's &lt;em&gt;no way &lt;/em&gt;we could do what we do without as much involvement, commitment and as many contributions as you all provide, and that's just hawesome. So from me, and all of us, a great big "Thanks, Dudes!". &lt;/p&gt;  &lt;p&gt;To submit for the contest we had to come up with a submission page that showed a lot of what's going on in the community. I have to say I was honestly shocked when we got most of it on one page. Holy cow is there a bunch of stuff happening, all the time!  You can &lt;a href="http://devcentral.f5.com/Default.aspx?tabid=172" target="_blank"&gt;check it out here.&lt;/a&gt; As you'll see on that page, we could really use your votes to make sure everyone knows what's going on here with DC, and how amazing it is.  &lt;a href="http://www.forrester.com/Groundswell/supporting/devcentral.html" target="_blank"&gt;So...vote now&lt;/a&gt;! We really appreciate it.&lt;/p&gt;  &lt;p&gt;I don't really know what else to say, to be honest.  You guys rock. You let us do what we're doing, and you're excited about it the entire time.  Thank you for being such rockstars and making DC what it is. It's pretty amazing when I stop and think about the last few years, and what's happened. Let's keep the train rolling, and turn the people that never thought this "community" thing made sense, especially for F5, on their ears.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:91c3c37a-0483-492a-ae0a-509c5857c9bc" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Forrester" rel="tag"&gt;Forrester&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Groundswell" rel="tag"&gt;Groundswell&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3611.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/09/12/a-groundswell-of-support.aspx</guid>
            <pubDate>Fri, 12 Sep 2008 17:47:37 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3611.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/09/12/a-groundswell-of-support.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3611.aspx</wfw:commentRss>
        </item>
        <item>
            <title>DevCentral Top5 8/29/08</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/29/devcentral-top5-82908.aspx</link>
            <description>&lt;p&gt;Goodness it's been a while since we've had a Top5, hasn't it? The past couple months have been insane for vacations/medical leave/paternity leave, etc on the DC team. Hopefully things are settling down now, and we can get back to our normal routine. Regardless, here I am, your faithful guide through the oceans of content on &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt;, committed to bringing you a weekly sampling of the Top5 coolest new things that showed up on &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt;. Even with parts of the team out, there's been lots of content, so buckle up, here's your Top5:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Dear Data Center Guy&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devcentral.f5.com/weblogs/macvittie/archive/2008/08/29/3572.aspx"&gt;http://devcentral.f5.com/weblogs/macvittie/archive/2008/08/29/3572.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Sometimes the things I pick for the Top5 are the most informative pieces I can find. Other times they're the most exciting and interesting because of some new announcement or content. This one is, well, just plain hawesome. Go check out Lori waxing away from the perspective of a lonely, forlorn BIG-IP. Follow this plea to the "Data Center Guy" and find out why it is that there's more than meets the eye to the BIG-IP, and why it's worth investing some more time getting to know yours.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Crack open the books, it's iRule time&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devcentral.f5.com/weblogs/Joe/archive/2008/08/29/crack-open-the-books-its-irule-time.aspx"&gt;http://devcentral.f5.com/weblogs/Joe/archive/2008/08/29/crack-open-the-books-its-irule-time.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Exciting news from the training group! F5's stellar training team now officially offers and is booking iRules training! This is fantastic news. Up until now the aspiring iRuler had to rely only on their wits, their browser, and the ever-faithful &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt;. Now there's an organized, formal way to get some hands-on, classroom instruction to get your iRuling experience jump started. This is something that's been a long-time request of the DC members, and I'm very, very pleased to be able to share this great news. Make sure you take a look and read the course description for more info.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;iControl Apps - #08 - System IP Statistics&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=264"&gt;http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=264&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Check out Joe flexing those iControl muscles yet again in this continuation of the iControl Apps series. In this edition Joe will walk you through how to query yet more fun statistics type stuff (very technical term) from the BIG-IP via iControl. If you ever wondered how to get access to aggregate, IP based statistics in a programmatic fashion, well, then this is the one you've been waiting for. Even if that hasn't been your dream since high school, this post is definitely worth checking out for more firepower to add to your iControl arsenal. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;20 Lines or Less #14&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/29/20-lines-or-less--14.aspx"&gt;http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/29/20-lines-or-less--14.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In our second week back on track with the 20LoL I manage to find still more cool examples of iRules fu that are byte sized at most. In less than 21 lines you can learn how to distribute email to the appropriate pools based on IP address. If that's not enough, we're doing HTTP inspection without HTTP profiles, too. Confusing? It won't be if you click through and take a gander. Good ole' TCP commands to the rescue. Take a peek, send some comments, add a suggestion.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; Weekly Roundup Episode 52 - The Road to 100&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devcentral.f5.com/weblogs/dcpodcast/archive/2008/08/29/3575.aspx"&gt;http://devcentral.f5.com/weblogs/dcpodcast/archive/2008/08/29/3575.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Last, but never least, is this week's &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; Roundup. This is a special edition of the podcast this week, because this week we wrapped up our 52&lt;sup&gt;nd&lt;/sup&gt; chat about DCLand, IT in general, and all sorts of other wacky stuff. With a year's worth of podcasts behind us, it's time to set our sights on 100 and keep on trucking, because there's plenty to talk about every week, that's for sure. This week listen to Don and Joe talk about all sorts of cool iControl applications and twitter and the like, and Colin try to keep up and explain that he's almost caught up from being out for 3+ weeks….honest. The Roundup is always a great way to get a dose of what we've been up to in a short amount of time, without even having to do any of that reading stuff. Have a listen and let us know what you think.&lt;/p&gt;  &lt;p&gt;There you have it, your Top5 for this week from &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt;. It's good to be back, and hopefully you faithful readers out there have been eager for this to get fired back up. If you've got questions or comments please feel free to drop me a line, as always. See you next week.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:fe7dc279-8e44-43d3-b700-4d145cdd7306" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Top5" rel="tag"&gt;Top5&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walkerer" rel="tag"&gt;Colin Walkerer&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3576.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/29/devcentral-top5-82908.aspx</guid>
            <pubDate>Fri, 29 Aug 2008 19:43:33 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3576.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/29/devcentral-top5-82908.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3576.aspx</wfw:commentRss>
        </item>
        <item>
            <title>20 Lines or Less #13</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/22/20-lines-or-less-13.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;What could you do with your code in 20 Lines or Less?&lt;/em&gt; That's the question I ask every week, 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.&lt;/p&gt;
&lt;p&gt;After a couple of weeks out of the office, I'm back at it with your weekly dose of iRules goodness in under 20 lines. This week's 20LoL comes from the forums as well as the codeshare. We've got some great examples here, including one iRule that can be used to help augment an already existing LTM module and give it some extra functionality...cool stuff!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Blocking Content with iRules&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26722&amp;amp;view=topic" title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26722&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26722&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is a good example of a robust, logified way to block certain URI parameters from being allowed through to the back-end servers. Aaron's gone to the trouble to both document the code and the output heavily. That might not be the fastest possible solution in production, but it sure is nice for testing.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt; when HTTP_REQUEST { &lt;br /&gt;  &lt;br /&gt;    # Log a debug message with client IP:port and the class contents &lt;br /&gt;    log local0. "[IP::client_addr]:[TCP::client_port]: class \$::badStrings: $::badStrings" &lt;br /&gt;  &lt;br /&gt;    # Check if the client IP is part of the hosts datagroup &lt;br /&gt;    if { [matchclass [IP::server_addr] equals $::Hosts]}{ &lt;br /&gt;  &lt;br /&gt;       # Log a debug message indicating the client IP matched the Hosts class &lt;br /&gt;       log local0. "[IP::client_addr]:[TCP::client_port]: matched Hosts class \$::Hosts: $::Hosts" &lt;br /&gt;  &lt;br /&gt;       # Check if the requested URI contains any known bad strings &lt;br /&gt;       if { [matchclass [string tolower [HTTP::uri]] contains $::badStrings]}{  &lt;br /&gt;  &lt;br /&gt;          # Log a debug message indicating the client matched the Host class and had a bad string in the URI &lt;br /&gt;          log local0. "Matched server IP and found bad string in [HTTP::uri]: \&lt;br /&gt;entry# [matchclass [string tolower [HTTP::uri]] contains $::badStrings]"  &lt;br /&gt;  &lt;br /&gt; 	 # Drop the TCP connection	  &lt;br /&gt; 	 drop  &lt;br /&gt;       } &lt;br /&gt;    } &lt;br /&gt; } &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MSM Whitelisting&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devcentral.f5.com/wiki/default.aspx/iRules/MSMBypass.html" title="http://devcentral.f5.com/wiki/default.aspx/iRules/MSMBypass.html"&gt;http://devcentral.f5.com/wiki/default.aspx/iRules/MSMBypass.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This codeshare entry shows how you can use an iRule to get even more out of MSM on your LTM. Oh how I love TLAs.  By creating a whitelist of known good IP addresses in this iRule, you can skip MSM processing and wring even more performance out of your BIG-IP...nice!&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;  priority 1&lt;br /&gt;  when CLIENT_ACCEPTED {  &lt;br /&gt;    if { [matchclass [IP::client_addr] equals $::white_list] } {  &lt;br /&gt;            log local0. "client: [IP::client_addr] found in white_list directed to http_test_pool"  &lt;br /&gt;          pool http_test_pool  &lt;br /&gt;          event disable all  &lt;br /&gt;    }  &lt;br /&gt;    elseif { [matchclass [IP::client_addr] equals $::black_list] } {  &lt;br /&gt;              log local0. " client: [IP::client_addr] found in black_list directed to http_test_pool_2"  &lt;br /&gt;          pool http_test_pool_2   &lt;br /&gt;                     # or discard  &lt;br /&gt;          event disable all  &lt;br /&gt;    }  &lt;br /&gt;  } &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Search and Replace via iRule&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=27079&amp;amp;view=topic" title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=27079&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=27079&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This example shows some of the things that can be done via the stream profile and selectively enabling replacements via iRules. The stream profile gives you plenty of ability to do data swapping in-line with even more speed than writing out the logic by hand in an iRule. Definitely good stuff.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST {    &lt;br /&gt;
  set replace_content 0   &lt;br /&gt;
  if {[HTTP::uri] contains "/atoz/"} {    &lt;br /&gt;
    set replace_content 1    &lt;br /&gt;
  }    &lt;br /&gt;
}    &lt;br /&gt;
when HTTP_RESPONSE {   &lt;br /&gt;
  if {$replace_content equals "1"} {   &lt;br /&gt;
    # Disable the stream filter by default   &lt;br /&gt;
    STREAM::disable   &lt;br /&gt;
    # Check if response type is text   &lt;br /&gt;
    if {[HTTP::header value Content-Type] contains "text" and [HTTP::header "User-Agent"] contains "***"}{   &lt;br /&gt;
      # Replace   &lt;br /&gt;
      STREAM::expression "@123@xyz@ @456@xyz@"   &lt;br /&gt;
      # Enable the stream filter for this response only   &lt;br /&gt;
      STREAM::enable   &lt;br /&gt;
    }   &lt;br /&gt;
  }   &lt;br /&gt;
}&lt;/font&gt;    &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;There you have it, three more examples of iRules goodness in less than 20 lines each. See you next week.&lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c906f882-3d0e-42e1-8407-21aad7500ed0" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/20%20Lines%20or%20Less"&gt;20 Lines or Less&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/iRules"&gt;iRules&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/HTTP"&gt;HTTP&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Colin%20Walker"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3558.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/22/20-lines-or-less-13.aspx</guid>
            <pubDate>Fri, 22 Aug 2008 23:35:17 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3558.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/08/22/20-lines-or-less-13.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3558.aspx</wfw:commentRss>
        </item>
        <item>
            <title>20 Lines or Less #12</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/07/24/20-lines-or-less-12.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;What could you do with your code in 20 Lines or Less?&lt;/em&gt; That's the question I ask every week, 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.&lt;/p&gt;  &lt;p&gt;Here we go again, three more examples of the powerful and interesting things you can do with iRules in less than 21 lines. Dipping again into the forums, with a few tweaks here and there (don't worry, I stayed honest to the rule, just took out comments and extra case comparisons, that kind of thing), we've got an action packed 20LoL this week.  Here we go:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SSL iRule on a non-SSL VIP&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26299&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26299&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26299&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This is a great example of using a single iRule for both HTTP and HTTPS traffic. In the forum post Deb shows a cool trick to allow us to sneak SSL commands past the iRule interpreter so that they are there when we need them, if a cert is found, but aren't used when the connection turns out to be straight HTTP.  Pretty cool stuff.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST {        &lt;br /&gt;  HTTP::header replace ClientIP [IP::remote_addr]         &lt;br /&gt;  if {[PROFILE::exists clientssl] == 1} {         &lt;br /&gt;    set cname "SSL::cipher name"   &lt;br /&gt;    set cbits "SSL::cipher bits"   &lt;br /&gt;    set cver "SSL::cipher version"   &lt;br /&gt;    HTTP::header replace SSLCipher [eval $cname]:[eval $cbits]-[eval $cver]   &lt;br /&gt;    if { [SSL::cert count] &amp;gt; 0} {         &lt;br /&gt;      HTTP::header replace SSLSubject [b64encode [X509::subject [SSL::cert 0]]]         &lt;br /&gt;      HTTP::header replace SSLClientCert [b64encode [SSL::cert 0]]         &lt;br /&gt;      HTTP::header replace WebProtocol "HTTPS-auth"         &lt;br /&gt;    } else {         &lt;br /&gt;      HTTP::header replace WebProtocol "HTTPS"         &lt;br /&gt;    }         &lt;br /&gt;  } else {         &lt;br /&gt;    HTTP::header replace WebProtocol "HTTP"         &lt;br /&gt;  }         &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Extracting DHCP Info&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25727&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25727&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25727&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This example for extracting DHCP info is very specific. It's looking for option 82 (Support for Routed Bridge Encapsulation) which may not be particularly useful to everyone out there, but the example stands as a great display of how iRules can help you tear into almost any kind of data, even DHCP data, and make intelligent decisions or actions based on that. Sure, it might take some re-working for your purposes, but what a cool example to get started with!&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;when CLIENT_DATA {        &lt;br /&gt;  binary scan [UDP::payload] x240H* dhcp_option_payload         &lt;br /&gt;  set option 0         &lt;br /&gt;  set option_length [expr {([UDP::payload length] -240) * 2 }]         &lt;br /&gt;  for {set i 0} {$option != 52 &amp;amp;&amp;amp; $i &amp;lt; $option_length} {incr i [expr { $length * 2 +2 }]} {         &lt;br /&gt;    binary scan $dhcp_option_payload x[expr $i]a2 option         &lt;br /&gt;    incr i 2         &lt;br /&gt;    binary scan $dhcp_option_payload x[expr $i]a2 length_hex         &lt;br /&gt;    set length [expr 0x$length_hex]         &lt;br /&gt;  }         &lt;br /&gt;  if { $i &amp;lt; $option_length } {         &lt;br /&gt;    incr i -[expr { $length * 2 -2 }]         &lt;br /&gt;    binary scan $dhcp_option_payload x[expr $i]a2 length_hex         &lt;br /&gt;    set length [expr 0x$length_hex]         &lt;br /&gt;    incr i 2         &lt;br /&gt;    binary scan $dhcp_option_payload x[expr $i]a[expr { $length * 2 }] circuit_id         &lt;br /&gt;  } else {         &lt;br /&gt;    drop         &lt;br /&gt;  }         &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;URI re-writing based on Load Balancing decision&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25791&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25791&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25791&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Talk about a chicken and egg demonstration. Hearing the title, you might think I have it backwards. When making this kind of decision in an iRule, the URI is often used to help make the load balancing decision. In this case, it's just the opposite. In this example we're letting the BIG-IP make a load balancing decision, then going back and updating the URI based on that decision, before the request is sent to the servers.  Very cool stuff!&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST_SEND {        &lt;br /&gt;  set uri [string tolower [clientside {HTTP::uri}]]         &lt;br /&gt;  log local0. "[IP::client_addr]:[TCP::client_port]: selected server details: [LB::server] - \$uri: $uri"         &lt;br /&gt;  if {[IP::addr [LB::server addr] equals 10.207.225.101] or [IP::addr [LB::server addr] equals 10.207.225.102] or [IP::addr [LB::server addr] equals 10.207.225.103] }{         &lt;br /&gt;    log local0. "[IP::client_addr]:[TCP::client_port]: matched server check for .3 or .4"         &lt;br /&gt;    switch -glob [HTTP::uri] {         &lt;br /&gt;      "*/gsfo/gsfopub*" {         &lt;br /&gt;        clientside {HTTP::uri "/Async/CMReceive.ashx"}         &lt;br /&gt;        log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/CMReceive.ashx"         &lt;br /&gt;      }         &lt;br /&gt;      "*/era/erapub*" {         &lt;br /&gt;        clientside {HTTP::uri "/Async/ERAReceive.ashx"}         &lt;br /&gt;        log local0. "[IP::client_addr]:[TCP::client_port]: updated URI to /Async/ERAReceive.ashx"         &lt;br /&gt;      }         &lt;br /&gt;      default {         &lt;br /&gt;        log local0. "[IP::client_addr]:[TCP::client_port]: didn't match URI checks"         &lt;br /&gt;      }         &lt;br /&gt;    }         &lt;br /&gt;  }         &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;There you have it, the forums deliver yet again. I have to say I love checking out all these cool, new, compact examples of iRules goodness. Many thanks to the awesome &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; community for their continued contributions. I'll see you next week for another 20 Lines or Less.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:562613d6-178b-4fc1-b788-51658534cdfd" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/20%20Lines%20or%20Less" rel="tag"&gt;20 Lines or Less&lt;/a&gt;,&lt;a href="http://technorati.com/tags/iRules" rel="tag"&gt;iRules&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DHCP" rel="tag"&gt;DHCP&lt;/a&gt;,&lt;a href="http://technorati.com/tags/URI%20Rewriting" rel="tag"&gt;URI Rewriting&lt;/a&gt;,&lt;a href="http://technorati.com/tags/SSL%20Information" rel="tag"&gt;SSL Information&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3484.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/07/24/20-lines-or-less-12.aspx</guid>
            <pubDate>Thu, 24 Jul 2008 22:51:31 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3484.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/07/24/20-lines-or-less-12.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3484.aspx</wfw:commentRss>
        </item>
        <item>
            <title>20 Lines or Less #11</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/07/16/20-lines-or-less-11.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;What could you do with your code in 20 Lines or Less?&lt;/em&gt; That's the question I ask every week, 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.&lt;/p&gt;
&lt;p&gt;This week's 20LoL comes care of both the codeshare and the forums alike.  I got to deal with a couple of particularly cool forum posts this week, one of which made the list, as did an iRule from the infamous hoolio himself. Dealing with HTTP and ranging from spiders to working around a work-week, these examples are yet more ways you can leverage iRules in less than 21 lines. Here we go:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rate Limiting Search Spiders&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26064&amp;amp;view=topic" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26064&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=26064&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Spiders on the web aren't the same pests as spiders in your house, but they can certainly have adverse effects if they're making an inordinate number of requests to your web-servers, and driving the load up.  Here's a cool example of how to avoid just that scenario. We've seen something similar a long time ago on &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; for Network Computing, but this is a good refresher. &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;when RULE_INIT { &lt;br /&gt;
  array set ::active_crawlers { } &lt;br /&gt;
  set ::min_interval 1 &lt;br /&gt;
} &lt;/font&gt; &lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;when HTTP_REQUEST { &lt;br /&gt;
  set user_agent [string tolower [HTTP::header "User-Agent"]] &lt;br /&gt;
  # Logic only relevant for crawler user agents &lt;br /&gt;
  if { [matchclass $user_agent contains $::Crawlers] } { &lt;br /&gt;
    # Throttle crawlers. &lt;br /&gt;
    set curr_time [clock seconds] &lt;br /&gt;
    if { [info exists ::active_crawlers($user_agent)] } { &lt;br /&gt;
      if { [ $::active_crawlers($user_agent) &amp;lt; $curr_time ] } { &lt;br /&gt;
        set ::active_crawlers($user_agent) [expr {$curr_time + $::min_interval}] &lt;br /&gt;
      } else { &lt;br /&gt;
        reject &lt;br /&gt;
      } &lt;br /&gt;
    } else { &lt;br /&gt;
      set ::active_crawlers($user_agent) [expr {$curr_time + $::min_interval}] &lt;br /&gt;
    } &lt;br /&gt;
  } &lt;br /&gt;
&lt;/font&gt;}&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Compression During the Work Week&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;view=topic&amp;amp;postid=25992" href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;view=topic&amp;amp;postid=25992"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;view=topic&amp;amp;postid=25992&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Coming through with a great example of how to have compression enabled only from 8AM-5PM, otherwise known as the normal US Workday, citizen_elah shows of his iRules kung fooery to help a fellow community member out. This same logic could be applied to almost anything else, besides compression, making this a great iRule to keep around in your back pocket.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;when CLIENT_ACCEPTED {    &lt;br /&gt;  set time_r [split [clock format [clock seconds] -format {%k:%M} ] " "]  &lt;br /&gt;  set time_f [expr {[expr {[lindex $time_r 0]*100}] + [lindex $time_r 1]}]     &lt;br /&gt;  if { not(($time_f &amp;gt;= 800) &amp;amp;&amp;amp; ($time_f &amp;lt;= 1700)) } {     &lt;br /&gt;    set compression "off"    &lt;br /&gt;  }    &lt;br /&gt;}    &lt;br /&gt;        &lt;br /&gt;when HTTP_RESPONSE {     &lt;br /&gt;  if { $compression eq "off" } {    &lt;br /&gt;    COMPRESS::disable     &lt;br /&gt;  }     &lt;br /&gt;}     &lt;br /&gt;   &lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;I then came through and offered some optional optimization, so I guess this could be considered your bonus-rule for the week.  It's easy when someone like elah does the legwork up front. ;) Check the link to see the extra example.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Fully Decode URI&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://devcentral.f5.com/wiki/default.aspx/iRules/FullyDecodeURI.html" href="http://devcentral.f5.com/wiki/default.aspx/iRules/FullyDecodeURI.html"&gt;http://devcentral.f5.com/wiki/default.aspx/iRules/FullyDecodeURI.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Representing the last leg of this HTTP tri-ath-a-post is an entry from our illustrious iRules CodeShare. This example shows how to be sure you're FULLY decoding your URI before processing. It correctly points out that sometimes encoded characters can contain encoded characters can contain encoded characters can contain....well, you get the point. See how one person decided to work around such issues in a scant 11 lines of code.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;when HTTP_REQUEST {&lt;br /&gt;  # decode original URI.&lt;br /&gt;  set tmpUri [HTTP::uri]&lt;br /&gt;  set uri [URI::decode $tmpUri]&lt;br /&gt;&lt;br /&gt;  # repeat decoding until the decoded version equals the previous value.&lt;br /&gt;  while { $uri ne $tmpUri } {&lt;br /&gt;    set tmpUri $uri&lt;br /&gt;    set uri [URI::decode $tmpUri]&lt;br /&gt;  }&lt;br /&gt;  HTTP::uri $uri&lt;br /&gt;&lt;br /&gt;  log local0. "Original URI: [HTTP::uri]"&lt;br /&gt;  log local0. "Fully decoded URI: $uri"&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre&gt; &lt;/pre&gt;
&lt;p&gt;&lt;font face="treb"&gt;There you have it, three more choice examples of iRules goodness in 20 Lines or Less.  Tune in again next week!&lt;/font&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2f6d9a6d-cfcc-4f17-ad85-3698f83942ce" style="margin: 0px; padding: 0px; display: inline;"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/20%20Lines%20or%20Less" rel="tag"&gt;20 Lines or Less&lt;/a&gt;,&lt;a href="http://technorati.com/tags/HTTP" rel="tag"&gt;HTTP&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="treb"&gt;#Colin&lt;/font&gt;&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3460.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/07/16/20-lines-or-less-11.aspx</guid>
            <pubDate>Thu, 17 Jul 2008 00:08:58 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3460.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/07/16/20-lines-or-less-11.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3460.aspx</wfw:commentRss>
        </item>
        <item>
            <title>DevCentral Top5 06/27/2008</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/27/devcentral-top5-06272008.aspx</link>
            <description>&lt;p&gt;With the amount of content washing constantly across the pages of &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; it can sometimes be impossible to keep up with everything, or to know what to read first. It's because of this that I started the Top5 series.  The intent is to allow me to act as your guide and lead you by the hand to point out the Top 5 things that I would choose to make sure you saw amongst the many awesome things gracing the DC pages in a given week. Broadening the reach of this series, I'm going to start making it a part of my blog, so you'll always be able to access the entries from weeks gone by. You'll also be able to access it easily to forward on the link to others or to re-view it as it will be a permanent fixture on &lt;a href="http://devcentral.f5.com/Default.aspx?tabid=101&amp;amp;nfpg645=1" target="_blank"&gt;my personal page&lt;/a&gt; in the &lt;a href="http://devcentral.f5.com/Default.aspx?tabid=96" target="_blank"&gt;about the team&lt;/a&gt; section.&lt;/p&gt;  &lt;p&gt;In any event, you'll be able to check here each week to look for the Top5 highlights of DC goodness throughout the week, hand-picked by yours truly or an esteemed guest writer when I'm not available. Please feel free to let me know what you think. Things you'd like to see in coming weeks, comments, questions, and all other non-encoded communiqué can be delivered by way of comment directly here. Without further adieu, this week's Top5:&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Election Hash Load Balancing&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/weblogs/dctv/archive/2008/06/26/3399.aspx" href="http://devcentral.f5.com/weblogs/dctv/archive/2008/06/26/3399.aspx"&gt;http://devcentral.f5.com/weblogs/dctv/archive/2008/06/26/3399.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this interview, Deb talks with one of our talented Field Engineers, Nathan, and discusses just what Election Hash Load balancing is, what makes it tick, why it's valuable, and why it's something that's fairly tricky to implement - unless you have iRules.  They get pretty detailed about just how the LB decisions are made and how this unique setup can be of immense value in certain situations like fronting large caches. Take a peek to see one heck of a cool iRule at work, discussed by the brain behind it, and one of DC's very own brains.&lt;/p&gt;  &lt;p&gt; &lt;strong&gt;iControl Apps - #02 - Local Traffic Summary&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=245" href="http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=245"&gt;http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=245&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Joe's at it again, scripting up cool and useful new iControl toys. In this most recent addition to the iControl Apps series Joe talks about the Network Map component in the GUI of the BIG-IP, and how to replicate some of the functionality contained within by use of, you guessed it, iControl.  Joe lays out some great examples of iControl and Powershell command usage, and gives you some very handy bits of code, as well as a link to the complete picture in the iControl codeshare.  Take a look and see what kind of useful numbers you can pull to get a bigger picture of your BIG-IP and what it's doing.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;On Walden's (very secure) Web&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/weblogs/macvittie/archive/2008/06/25/3388.aspx" href="http://devcentral.f5.com/weblogs/macvittie/archive/2008/06/25/3388.aspx"&gt;http://devcentral.f5.com/weblogs/macvittie/archive/2008/06/25/3388.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this post to Lori's popular blog she talks about Web Application Firewalls and Web Application Security in general.  I enjoy the discussion she has about what it would take for a developer to "truly" secure an application, especially requirement #10. She touches on some important elements of Web Security and some of the issues that are faced today. This one's definitely worth a read.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Selective DNS Persistence on GTM&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=243" href="http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=243"&gt;http://devcentral.f5.com/Default.aspx?tabid=63&amp;amp;articleType=ArticleView&amp;amp;articleId=243&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Persistence is a concept that's been around for a long time now. Most of use are probably pretty comfortable with the term and what it means, as well as using it in our deployments where necessary.  What about DNS Persistence, though? In this Tech Tip you'll get a peek at how iRules on your GTM device can allow you to selectively enable DNS level persistence.  Read more to find out when this might be useful, and see an example of the simple iRule that can get you there.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Making Use of kSOAP2 at Dr. Dobbs&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/weblogs/dmacvittie/archive/2008/06/24/3385.aspx" href="http://devcentral.f5.com/weblogs/dmacvittie/archive/2008/06/24/3385.aspx"&gt;http://devcentral.f5.com/weblogs/dmacvittie/archive/2008/06/24/3385.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It's a banner day when one of our very own here at DC get published in a publication like Dr. Dobbs. Our esteemed colleague Don MacVittie has done just that this month, and the article is well worth a look. Inside he'll talk to you about the use of kSOAP2, how it can be a boon in an ever increasingly mobile world, and how iControl and kSOAP2 can play nice together to build some wicked cool remote apps for your mobile device. Remote management of the BIG-IP via a mobile device? Why sure, we can do that, just ask Don. The link above is to his blog mentioning this awesome achievement, &lt;a href="http://www.ddj.com/mobile/208800166" target="_blank"&gt;here's a direct link to the Dobbs article.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;That's it for this week's Top5. Check back every Friday for another edition, and I'll help you keep an eye on what I think you need to know.  There's plenty more where this came from, though, so don't be afraid to dig in yourself, and take in the rest of the awesome content DC has to offer.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d9229f36-b5a3-45a6-85f5-235e1479b13b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Top%205" rel="tag"&gt;Top 5&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3409.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/27/devcentral-top5-06272008.aspx</guid>
            <pubDate>Fri, 27 Jun 2008 21:12:30 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3409.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/27/devcentral-top5-06272008.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3409.aspx</wfw:commentRss>
        </item>
        <item>
            <title>20 Lines or Less #9</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/19/20-lines-or-less-9.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;What could you do with your code in 20 Lines or Less?&lt;/em&gt; That's the question I ask every week, 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.&lt;/p&gt;
&lt;p&gt;This week I've got a combination of entries from our awesome forum users, and a rule I wrote a while back to meet a certain need at the time. We're almost at 10 editions of the 20LoL, and I'm looking forward to many more. Hopefully you're still finding it interesting and useful. Shoot me a line and let me know what's good, what's bad, what can be better and what you want to hear about. &lt;/p&gt;
&lt;p&gt;In the meantime, here's this week's 20 Lines or Less&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Multi-Conditional Redirect&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25219&amp;amp;view=topic" title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25219&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25219&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hoolio delivers this short and sweet iRules in the forums to show how you can use multiple pieces of data to decide when to perform a redirect.  Not only does he make use of a normal string comparison, but also an IP::addr comparison against the client's IP address. So in one line you're getting two comparisons on two different pieces of data. This is a good example for someone looking to redirect only a small subset of people, based on multiple pieces of data.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST {        &lt;br /&gt;
   if { [string tolower [HTTP::path]] ends_with "/_grid/print/print_data.aspx" \&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new"&gt;   and (not ([IP::addr [IP::client_addr]/8 equals 10.0.0.0]))} {         &lt;br /&gt;
      HTTP::redirect "&lt;/font&gt;&lt;a href="http://google.com"&gt;&lt;font face="courier new"&gt;http://google.com"&lt;/font&gt;&lt;/a&gt;       &lt;br /&gt;
&lt;font face="courier new"&gt;   }        &lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Syslog Priority Rewriting&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is a variation on some actual code I wrote a while back to translate the syslog priority numbers when needed.  Depending on the different syslog configurations, these numbers may not line up. This can be a problem when you're trying to aggregate many syslog systems into one main log server. This iRule shows how you can catch these messages inline and modify them with whatever equation fits your environment.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;when CLIENT_DATA {        &lt;br /&gt;
  set pri [regexp -inline {&amp;lt;\d+&amp;gt;} [UDP::payload] ]         &lt;br /&gt;
  set newPri [expr ( ($pri - (($pri / 6) * 8) ) ) ]         &lt;br /&gt;
  regsub $pri [UDP::payload] $newPri newPayload         &lt;br /&gt;
  UDP::payload replace 0 [UDP::payload length] $newPayload         &lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Duplicate Cookie Definitions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25215&amp;amp;view=topic" title="http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25215&amp;amp;view=topic"&gt;http://devcentral.f5.com/Default.aspx?tabid=53&amp;amp;forumid=5&amp;amp;postid=25215&amp;amp;view=topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Going back to the forums, it seems that hoolio is at it again. In this cool example he shows a fellow community member how to check for and remove multiple Set-Cookie entries with the same name.  This way they can ensure that there is only one cookie present, regardless of how many times different apps may have tried to set it. This one looks a little long, but remove the comments and some of the white space, and it's under 20 lines...I checked.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt; when HTTP_RESPONSE {   &lt;br /&gt;  &lt;br /&gt;    # Insert some test response headers &lt;br /&gt;    HTTP::header insert Set-Cookie {SESSIONID=AAAAAAAA; domain=.domain.com; path=/path/1} &lt;br /&gt;    HTTP::header insert Set-Cookie {keeper=don't delete; domain=.domain.com; path=/path/2} &lt;br /&gt;    HTTP::header insert Set-Cookie {SESSIONID=BBBBBBBB; domain=.domain.com; path=/path/3} &lt;br /&gt;    HTTP::header insert Set-Cookie {SESSIONID=CCCCCCCC; domain=.domain.com; path=/path/4} &lt;br /&gt;  &lt;br /&gt;    log local0. "Set-Cookie header values: [HTTP::header values Set-Cookie]" &lt;br /&gt;    log local0. "First Set-Cookie header which starts with SESSIONID: \&lt;br /&gt;      [lsearch -glob -inline [HTTP::header values Set-Cookie] "SESSIONID*"]" &lt;br /&gt;    log local0. "Last  Set-Cookie header which starts with SESSIONID: \&lt;br /&gt;      [lsearch -glob -inline -start end [HTTP::header values Set-Cookie] "SESSIONID*"]"&lt;br /&gt;  &lt;br /&gt;    set set_cookie_header [lsearch -glob -inline -start end [HTTP::header values Set-Cookie] "SESSIONID*"] &lt;br /&gt;    log local0. "\$set_cookie_header: $set_cookie_header" &lt;br /&gt;     &lt;br /&gt;    # Remove all SESSIONID cookies &lt;br /&gt;    while {[HTTP::cookie exists SESSIONID]}{ &lt;br /&gt;       HTTP::cookie remove SESSIONID &lt;br /&gt;    } &lt;br /&gt;    log local0. "Set-Cookie values: [HTTP::header values Set-Cookie]" &lt;br /&gt;  &lt;br /&gt;    # Re-insert the last SESSIONID Set-Cookie header	 &lt;br /&gt;    HTTP::header insert Set-Cookie $set_cookie_header &lt;br /&gt;     &lt;br /&gt;    log local0. "SESSIONID cookie: [HTTP::cookie SESSIONID]"    &lt;br /&gt; }&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;There you have it, 3 more examples in under 60 lines of code. Keep checking back every week to see what cool things can be done in just a few keystrokes. Many thanks to the awesome community and the people posting these examples. You're truly making DC a great place to be. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0px; padding: 0px; display: inline;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6070fb94-b387-46a3-9e66-4b9a67c7ff3e" class="wlWriterSmartContent"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/DevCentral"&gt;DevCentral&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/iRules"&gt;iRules&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/20%20Lines%20or%20Less"&gt;20 Lines or Less&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Cookies"&gt;Cookies&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Redirects"&gt;Redirects&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Syslog"&gt;Syslog&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/UDP"&gt;UDP&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/HTTP"&gt;HTTP&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Colin%20Walker"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3375.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/19/20-lines-or-less-9.aspx</guid>
            <pubDate>Thu, 19 Jun 2008 18:57:25 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3375.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/19/20-lines-or-less-9.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3375.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Back at it</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/16/back-at-it.aspx</link>
            <description>&lt;p&gt;I'm back!  I know you were all waiting anxiously with baited breath for me to announce my triumphant return to my &lt;a title="" href="http://devcentral.f5.com" target="_blank"&gt;DevCentral&lt;/a&gt; duties, so I wanted to be sure that you could exhale and calm your nerves.  Okay, on a more serious note, I'm just excited to be back at it and doing more cool stuff here with the community and the team. I'm rested, I'm recharged, and now I'm ready to get back in the trenches, as it were. I visited with some family, took a nice long drive across some pretty countryside, relaxed, gamed, and generally had a good time, but it's good to be back.  As much as I loved having some time to relax and cool my jets, I'm really excited to be back and I'm looking forward to getting back into the rhythm of things here in DC Land.&lt;/p&gt;  &lt;p&gt;I want to take a second to say thanks to the community for their support, and to my awesome team for keeping things rolling along and filled with awesomeness as always. It's cool to come back after a while out and see the awesomeness train in full motion. &lt;/p&gt;  &lt;p&gt;Anyway, time to jump back in, see you out there...&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:66555bf4-36bc-4fc3-a04f-d6927359429b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3364.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/16/back-at-it.aspx</guid>
            <pubDate>Mon, 16 Jun 2008 18:06:09 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3364.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/06/16/back-at-it.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3364.aspx</wfw:commentRss>
        </item>
        <item>
            <title>20 Lines or Less #8</title>
            <link>http://devcentral.f5.com/weblogs/cwalker/archive/2008/05/29/20-lines-or-less-8.aspx</link>
            <description>&lt;p&gt;&lt;em&gt;What could you do with your code in 20 Lines or Less?&lt;/em&gt; That's the question I ask every week, 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.&lt;/p&gt;  &lt;p&gt;For this week's 20LoL sampling I've dipped into my own private stash of iRule goodness. Some of these are oldies but goodies, one of them I actually just wrote yesterday as an example for &lt;a href="http://devcentral.f5.com/weblogs/macvittie/archive/2008/05/29/3309.aspx" target="_blank"&gt;Lori's Blog&lt;/a&gt;.  As such the newly written example is the only one with a URI. The others will just have a description and the iRule source.&lt;/p&gt;  &lt;p&gt;I'm sure I'll be diving back into the Forums and CodeShare in the coming weeks as there just seems to be an endless stream of cool stuff to dig through out there, but I wanted to toss up a few of my own rules this week. Be gentle with comments, some of these are old as I said. ;)&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Content Scrubbing for Adobe Flash Exploit&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://devcentral.f5.com/weblogs/macvittie/archive/2008/05/29/3309.aspx" href="http://devcentral.f5.com/weblogs/macvittie/archive/2008/05/29/3309.aspx"&gt;http://devcentral.f5.com/weblogs/macvittie/archive/2008/05/29/3309.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This iRule digs through the contents of the HTTP responses being sent out from your servers and looks for known exploit sites, then blocks those responses from going to your users. In this way it attempts to help protect them from the spread of &lt;a href="http://devcentral.f5.com/weblogs/macvittie/archive/2008/05/29/3309.aspx" target="_blank"&gt;the Adobe Flash exploit Lori's been talking about&lt;/a&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;when HTTP_RESPONSE {       &lt;br /&gt;  HTTP::collect        &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;when HTTP_RESPONSE_DATA {       &lt;br /&gt;  switch -glob [string tolower [HTTP::payload]] {        &lt;br /&gt;    "*0novel.com*" -        &lt;br /&gt;     "*dota11.cn*" -        &lt;br /&gt;     "*wuqing17173.cn*" -        &lt;br /&gt;     "*woai117.cn*" -        &lt;br /&gt;     "*guccime.net*" -        &lt;br /&gt;    "*play0nlnie.com*" {        &lt;br /&gt;      HTTP::respond 200 content "The server is currently unable to serve the requested content. Please try again later."        &lt;br /&gt;      log local0. "Adobe Flash exploit infected Server IP: [IP::server_addr]."        &lt;br /&gt;    }        &lt;br /&gt;  }        &lt;br /&gt;  HTTP::release        &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;IP Client Limiting via Array&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This iRule was written to deal with a &lt;em&gt;very&lt;/em&gt; high-volume need for client limiting.  By storing the IPs in an array and accessing them in the most optimized format I could come up with, this rule was able to stand up to some pretty impressive numbers. If memory serves it was somewhere near 200K connections per second with nearly 3 million concurrent connections. Not too shabby!&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;when RULE_INIT {       &lt;br /&gt;  array set connections { }        &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;when CLIENT_ACCEPTED {       &lt;br /&gt;  if { [info exists ::connections([IP::client_addr])] } {        &lt;br /&gt;    if { [incr ::connections([IP::client_addr])] &amp;gt; 1000 } {        &lt;br /&gt;      reject        &lt;br /&gt;    }         &lt;br /&gt;  } else {        &lt;br /&gt;    set ::connections([IP::client_addr]) 1        &lt;br /&gt;  }        &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;when CLIENT_CLOSED {       &lt;br /&gt;  if { [incr ::connections([IP::client_addr]) -1] &amp;lt;= 0 } {        &lt;br /&gt;     unset ::connections([IP::client_addr])        &lt;br /&gt;  }        &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Selective HTTPS Redirect&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is a slight variant on a popular concept. This iRule does a selective redirect to HTTPS by checking a given class to see if the incoming URI is one that should be served via HTTPS. The neat part here is that it also does a port check and a preventative else statement, meaning this iRule should be able to be deployed on a global virtual, serving all ports, where most examples like this require the traffic to be broken up into two VIPS, port 80 and port 443, to avoid infinite looping.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="courier new"&gt;when HTTP_REQUEST {       &lt;br /&gt;  if { [TCP::local_port] == 80 } {        &lt;br /&gt;    log local0. "connecting on HTTP server"        &lt;br /&gt;    if { [matchclass [HTTP::uri] starts_with $::secure_uris] } {        &lt;br /&gt;      HTTP::redirect "&lt;/font&gt;&lt;font face="courier new"&gt;http://[HTTP::host][HTTP::uri]"&lt;/font&gt;      &lt;br /&gt;&lt;font face="courier new"&gt;    }       &lt;br /&gt;  }        &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So there you have it, another few examples of what can be done via iRules in less than 21 lines of code. This 20 LoL brought to you from my personal vault, so I hope you enjoy. As always, please let me know if you have any feedback, comments, questions, suggestions, musical recommendations or other pertinent information to share. See you next week.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:61b15fa7-3e13-482e-8413-3520a85ba4c3" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DevCentral" rel="tag"&gt;DevCentral&lt;/a&gt;,&lt;a href="http://technorati.com/tags/iRules" rel="tag"&gt;iRules&lt;/a&gt;,&lt;a href="http://technorati.com/tags/20%20Lines%20or%20Less" rel="tag"&gt;20 Lines or Less&lt;/a&gt;,&lt;a href="http://technorati.com/tags/HTTPS" rel="tag"&gt;HTTPS&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Client%20Limiting" rel="tag"&gt;Client Limiting&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Adobe" rel="tag"&gt;Adobe&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Flash" rel="tag"&gt;Flash&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Colin%20Walker" rel="tag"&gt;Colin Walker&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;   &lt;br /&gt;#Colin&lt;/p&gt;&lt;div class='blogtags'&gt;&lt;/div&gt;&lt;img src="http://devcentral.f5.com/weblogs/cwalker/aggbug/3318.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Colin Walker</dc:creator>
            <guid>http://devcentral.f5.com/weblogs/cwalker/archive/2008/05/29/20-lines-or-less-8.aspx</guid>
            <pubDate>Thu, 29 May 2008 23:30:33 GMT</pubDate>
            <wfw:comment>http://devcentral.f5.com/weblogs/cwalker/comments/3318.aspx</wfw:comment>
            <comments>http://devcentral.f5.com/weblogs/cwalker/archive/2008/05/29/20-lines-or-less-8.aspx#feedback</comments>
            <wfw:commentRss>http://devcentral.f5.com/weblogs/cwalker/comments/commentRss/3318.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>