Forum Discussion
iRule to display one time warning message
If I may add, the trick is going to be how you track when and if a user has seen the message. HTTP is stateless in nature, so you need a mechanism to detect that the user has seen it at some point in that day. Some options include a long-lived session table entry on the LTM that stores the client's IP or user logon information, or more basically, a persistent cookie in the browser that expires daily. Here's an example:
when HTTP_REQUEST {
if { not ( [HTTP::cookie exists BANNERMESSAGE] ) } {
set expires [clock format [clock seconds] -format "%A, %d-%b-%Y 20:00:00"]
HTTP::respond 200 content "html banner content" "Set-Cookie" "BANNERMESSAGE=1; path=/; expires=$expires"
}
}
If the BANNERMESSAGE cookie doesn't exist in the request, the iRule generates the HTML banner page and inserts a persistent (file-based) cookie that expires at 8pm that day. You'd probably want a link or button in the HTML content that lets the user acknowledge the message and redirects back to the application.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com