Problem this snippet solves:
Description: DevCentral - An F5 Technical Community
Related Article
Code :
when RULE_INIT {
# replace the value of the _uacct variable with your Google Analytics account.
set static::warnie6 "<!--\[if lte IE 6\]>
<style type='text/css'>
#ie6msg {border:3px solid #c33; margin:8px 0; background:#fcc; color:#000;}
#ie6msg h4 {margin:8px; padding:0;}
#ie6msg p {margin:8px; padding:0;}
#ie6msg p a.getie7 {font-weight:bold; color:#006;}
#ie6msg p a.ie6expl {font-weight:bold; color:#006;}
</style>
<div id='ie6msg'>
<h4>Did you know that your browser is out of date?</h4>
<p>To get the best possible experience using my website I recommend that you upgrade your browser to a newer version.
The current version is
<a class='getie7' href='http://www.microsoft.com/windows/Internet-explorer/default.aspx'>Internet Explorer 8</a>.
The upgrade is free. If you are using a PC at work you should contact your IT-administrator.
Either way, I'd personally like to encourage you to stop using IE6
and try a more secure and Web Standards-friendly browser.</p>
<p>You could also try some other popular browsers like
<a class='ie6expl' href='http://mozilla.com'>FireFox</a> or <a class='ie6expl' href='http://www.opera.com'>Opera</a>.</p>
</div>
<!\[endif\]-->"
}
when HTTP_REQUEST {
# Don't allow data to be chunked
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
}
when HTTP_RESPONSE {
if { [HTTP::header Content-Type] starts_with "text/html" } {
if { [HTTP::header exists "Content-Length"] } {
#log local0. "content length: [HTTP::header {Content-Length}]"
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1000000
}
#log local0. "Collecting $content_length bytes"
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
when HTTP_RESPONSE_DATA {
#log local0. "Content Type: [HTTP::header Content-Type]"
set idx [string first "" [HTTP::payload]]
if { -1 == $idx } {
set idx [string first "" [HTTP::payload]]
}
#log local0. "html body tag found at $idx"
if { -1 == $idx } {
set idx 0
} else {
incr idx 6
}
HTTP::payload replace $idx 0 $static::warnie6
}