Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

irule to pop up a window then continue to page

We have a request to grab all traffic coming in to a specific URI, pop a window up with a message for about 15 seconds then continue to the page.  The specific page/application is going away and they want to use this to educate users each time they go to the page.  So the message would be about the page being retired on X date.  I have been reading about doing redirection but haven't seen anything that would let you code to pop up a message window.  Any suggestions/help is greatly appreciated.
0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Hi Lynda,

You could send an HTTP response using HTTP::respond with a meta-refresh:

http://en.wikipedia.org/wiki/URL_redirection

Aaron
1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
This logic will fire only on the first access to a site during the session, then get out of the way for the remainder of the session. Something like this is what you're likely going to need to do:

when RULE_INIT {
    set static::refresh_time 15
	set static::notification_page {
        <html lang=\"en_US\">
		<head><title>System Notification</title>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\">
		<meta http-equiv=\"CACHE-CONTROL\" content=\"NO-CACHE\">
		<meta http-equiv=\"PRAGMA\" content=\"NO-CACHE\">
		<meta http-equiv=\"EXPIRES\" content=\"Mon, 22 Jul 2002 11:12:01 GMT\">
		<meta http-equiv=\"refresh\" content=\"$static::refresh_time\">
		</head>
		<body>
		<h1>System Notification</h1>
		<hr>
		<p>This is an important announcement. You may need to take some sort of action, or no
		action at all. It is important that you read this entirely. If some sort of action is
		needed, then do it. Otherwise do nothing. That is all.</p>
		<p>Wait $static::refresh_time seconds to continue, or click <a href=\"[HTTP::uri]\">here to continue.</a></p>
		</body>
		</html>
	}  
}

when HTTP_REQUEST  {
	if { (not [HTTP::cookie exists NotificationDone]) } {
		HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=1; path=/; domain=.[HTTP::host]"
	}
}
1
Comments on this Answer
Comment made 10-May-2016 by ccna55 14
Thanks Just what i was looking for.
0
Comment made 11-May-2016 by Domai 512
Joel thank you ....This is perfect.
0
Comment made 31-Mar-2017 by Mike P. 263

I know this is an older one now but I am using this to tell users that our page has moved and that they have until June 1 to update bookmarks. I am actually trying to use it on 4 different virtual servers but for some reason if I make a change to any one of the 4 irules (they each have a specific url to redirect to) then the F5 seems to cache the last irule and uses the same one for all 4 VS's.

Any clue as to why it would do that?

0
Comment made 01-Apr-2017 by Niels van Sluis 2744

The static::notification_page variable is being set for all 4 irules. You can avoid this by making this variable unique for every iRule. For more info see:

1
Comment made 03-Apr-2017 by Mike P. 263

Niels, thanks again. I actually learned something new and the day is early :-)

0