Help Kill IE6 with iRules

For those that haven’t gotten the memo yet, IE6 is on its way out. I know this has been something developers, myself included, have been hoping for for quite some time now. IE6 is old and frankly doesn’t offer the support needed by far too many web applications these days. None of this is news, however. We’ve been hoping that it would go away for a while, so why do I say it’s finally on its way out? Because it wasn’t until (semi) recently that Microsoft was leading the charge to make it go away.

I hear you out there, “Microsoft trying to kill off their own browser? Surely that can’t be true'”, you say, aghast that I would suggest such a thing. My response - Microsoft is indeed trying to ensure that IE6 users get upgraded to a newer, more secure, more feature-rich version. This makes total sense when you think about it. It improves the user experience, does away with a whole host of vulnerabilities targeting the old browser version, improves the overall perception of “IE” as a browser, as more users will see the improvements made in newer versions, etc. It’s a good move.

The next question you’re asking yourself is, “How can iRules help?”. I’m glad you asked. If you check the “Join The Cause” section of the site ( you’ll see that they provide a banner that sites interested in helping rid the world of IE6 can display for users accessing the site on the geriatric browser that will not only educate them but provide them a direct link to the IE9 download page where they can get an up to date version. If you’re like most people running a web based application these days, you have more than one server, so updating all of them to display this might be time consuming and tiresome, let alone error prone. A faster, better way to do this could be just to use a simple iRule to insert this banner for you.

If you’re a long time DevCentral user you’ll recall that Joe did something similar in his blog a while back that he titled “Help Users Get Out Of The Stone Age with iRules”. That was written back in February of 2009 though, so let’s help Joe get his iRule out of the v9 age (admittedly not as bad as the stone age) with a little bit of a v10 update, and the fancy new banner provided by Microsoft.

First you’ll need to ensure that you have the Stream Profile enabled for your virtual. You can enable this by navigating to: Virtual Servers –> <YourVirtual> –> Configuration: Advanced. Here you’ll see lots of options, one of which is where you’re able to select any of the stream profiles you’ve created, or the default stream profile, which will work fine for our purposes.

Next you’ll want to make sure that you’re accounting for the possibility that the responses that you’re looking to modify coming from the server are chunked. If they are, we have to expect it otherwise you won’t be able to accurately modify the payload. There’s an easy fix for this though, in the Response Chunking option within the HTTP profile. If you’re using the default profile, this should be set to Selective by default anyway, which will work just fine with the Stream profile.


Now that we’ve ensured the config is set up to support our transformation, we can look at the iRule itself, which is pretty straight forward. :


   1: when RULE_INIT {
   2:   set static::warnie6 "<body><!--\[if lt IE 7\]> \
   3: <div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;'> \
   4: <a href=\"\">\
   5: <img src=\"\" border=\"0\" height=\"42\" width=\"820\" \
   6: alt=\"You are using an outdated browser. For a faster, safer browsing experience, \
   7: upgrade for free today.\" /></a></div> <!\[endif\]-->"
   8: }
  10: when HTTP_RESPONSE {
  11:   STREAM::disable
  12:   if { [HTTP::header Content-Type] contains "text/html" } {
  13:     STREAM::expression {@<body>@@ @<BODY>@@}
  14:     STREAM::enable
  15:   }  
  16: }
  18: when STREAM_MATCHED {
  19:   STREAM::replace $static::warnie6
  20: }

As you can see all we’re doing is checking for either “<body>” or “<BODY”> and replacing that with a body tag and the code required to display the banner. We’re doing this with a static variable, to ensure CMP compliance, and the stream profile, for maximum efficiency.

There you have it, iRules helping to kill IE6, at Microsoft’s request. I bet you didn’t think you’d see that today, did you?

Published Mar 22, 2011
Version 1.0

Was this article helpful?


  • Nice irule Colin , but I feel bad spending even a single cpu-cycle in helping MS clean up the mess 'they' created.


    Really, if their intention is to get rid of IE6 they can provide a more recent browser ( free of charge ) to all IE6 users.


    This all smells like free banners/marketing/endorsement.


  • Colin_Walker_12's avatar
    Historic F5 Account
    @ ib That's certainly one take on it I suppose. I don't see it that way, but the me of 10 years ago probably would have. Back then I was a fiery Linux zealot and was anti MS all the way. Refused to run it for anything, even my laptops and this was back before easy driver sourcing on Linux. ;)



    Now days, I find there's a tool befitting every job, and MS makes some fine tools, depending on the job you're doing. I think they've made huge strides in the browsers they're offering these days vs the horror that was IE6, so while it may indeed be free marketing, I don't feel so guilty about offering up some help to rid the world of bad, archaic browsers that can cause damage by way of bot nets. It's for the greater good and all that...or something.