IRule - 11.6 HF4 User-Header and redirect to original page.
I am trying to write a custom iRule to perform the following:
- Display a warning to the end user depending on the browser version they are using
- An example of this, user is on Internet Explorer 8 and a warning message appears to tell them to upgrade or set TLS options. A user on Internet Explorer 11 wouldn't get the same message.
- The above would apply to other browser type/versions as well.
- When the message is displayed it will then allow them to continue to the original page.
So user connects to "https://workwebsite.com" and when they use a browser I want to warn them about they get a "custom HTML" page and then the F5 continues to load "https://workwebsite.com" as per normal
After some reading on DevCentral etc. an iRule seems to be the best way to go from here. I don't really want to have to touch the APM policy I have in place (if it can be avoided). This is the iRule that I have constructed so far (with some bits and pieces from around DevCentral and others). I want this message to appear constantly (for now). This iRule as it stands doesn't do anything with the cookie as it still does the redirect. If I put in my website (it basically loops - i.e. it processes, shows the message, redirects to the website and shows the message, over and over and over).
** iRule **
when RULE_INIT { set static::refresh_time 60 set static::notification_page { Browser Notification http://workwebsite.com">
Browser Notification
You are using an unsupported browser.
It is a requirement when accessing our systems to use the latest and greatest
This message will close in 15 seconds
} }
when HTTP_REQUEST { switch -glob [ string tolower [HTTP::header User-Agent]] { "msie 11.0" - "msie 10.0" - "msie 9.0" - "msie 8.0" - "msie 7.0" - "msie 6." { HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" log local0. "Client IP:[IP::client_addr] has been redirected with user agent :[HTTP::header User-Agent]" } "Set-Cookie" "WRONGBROWSER=1; path=/; expires=$expires" default { go to a default location if nothing matches } } }