Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud.
We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
What could you do with your code in 20 Lines or Less? That's the question I ask (almost) 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 we’ve got more cool iRules toys to show off. That’s not the impressive part, the impressive part is that only two of the three examples are from hoolio. I know, right? Joking aside, a huge thank you to hoolio for his astounding contributions to the community, and to everyone else that’s out there posting questions, answers and examples of what iRules, iControl and all the other F5 technologies can do.
In this example hoolio shows how you can use a switch statement to simplify performing a couple of URI rewrites based on the hostname. The example is a clean way to achieve something that can quickly get messy and hard to debug when using if/else chains.
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "keyaccount.company.com" { # Rewrite / to /path/path/index.html if {[HTTP::path] eq "/"}{ HTTP::uri "/path/path/index.html" }
# Rewrite host header to keyaccount.othercompany.com HTTP::header replace Host "keyaccount.othercompany.com"
# Use pool1 pool pool1 } "keyaccount.company.com" { # Rewrite / to /path/path/index.html if {[HTTP::path] eq "/"}{ HTTP::uri "/path/path/index.html" }
# Rewrite host header to keyaccount.othercompany.com HTTP::header replace Host "keyaccount.othercompany.com"
# Use pool1 pool pool1 } default { # Take some default action for other host header values? } } }
User cmbhatt chimed in with a solid response to a request looking for hostname re-writing. Rather than perform some more complex splitting, lreplacing and joining he makes use of the string map command to reduce the complexity and number of steps. This one’s another good example of making something that’s easy to read, useable and portable.
Hoolio’s back (shocking) with another awesome example. His response to player’s request for some user access control guidance resulted in a good look at how you can use a simple iRule to make quick work of login restrictions. This is a great way to allow only certain people access to given areas of a site.
About Colin Walker Coming from a *Nix Software Engineering background, Colin is no stranger to long hours of coding, testing and deployment. His personal experiences such as on-stage performance and the like have helped to foster the evangelist in him. These days he splits his time between coding, technical writing and evangalism. He can be found on the road to just about anywhere to preach the good word about ADCs, Application Aware networking, Network Side Scripting and geekery in general to anyone that will listen.
Colin currently helps manage and maintain DevCentral (http://devcentral.f5.com). He is also a contributor in many ways, from Articles to Videos to numerous forum posts, to iRules coding and whatever else he can get his hands on that might benefit the community and allow it to continue to grow.
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice: