Forum Discussion
Ram_75191
Nimbostratus
Dec 11, 2013Notification page for selective URI's (F5 load balancer (version 11.2.1)
Hi,
We want to show a Notification page for some of the URI's before the user sees the login page. Here are the scenarios:
https:///A
https:///B
https:///C
https:///D
We want the users coming into UR...
Ram_75191
Nimbostratus
Dec 18, 2013Hi All - Thank you for your responses. Here is the iRule that worked for us.
when RULE_INIT { set static::debug 0 set static::cookie_expire_time 86400 set static::refresh_time 10 set static::notification_page " Site unavailable" } when HTTP_REQUEST { set mod_path [lindex [split [string trim [string tolower [HTTP::path]] "/"] "/"] 0]
if { $static::debug } {
log local0. "The variable mod_path is: $mod_path"
log local0. "Refresh Time: $static::refresh_time"
}
switch $mod_path {
"aaaaaaa" -
"bbbbbbb" -
"ccccccc" {
if { $static::debug } {
log local0. "Matched aaaaaaa pool!"
}
pool http_pool
}
"ddddddd" {
if { (not [HTTP::cookie exists NotificationDone]) } {
if { $static::debug } {
log local0. "Cookie was not set in ddddddd! Setting cookie!"
}
HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=[clock seconds]; path=/; domain=.[HTTP::host]"
} elseif { [eval [[clock seconds] - [HTTP::cookie value "NotificationDone"]]] > $static::cookie_expire_time } {
if { $static::debug } {
log local0. "CNotification Done Value: [HTTP::cookie value "NotificationDone"] Expire Time: $static::cookie_expire_time"
}
HTTP::cookie remove "NotificationDone"
HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=[clock seconds]; path=/; domain=.[HTTP::host]"
}
pool http_pool
}
"" -
"eeeeeeee" {
if { (not [HTTP::cookie exists NotificationDone]) } {
if { $static::debug } {
log local0. "Cookie was not set in eeeeeee! Setting cookie!"
}
HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=[clock seconds]; path=/; domain=.[HTTP::host]"
} elseif { [eval [[clock seconds] - [HTTP::cookie value "NotificationDone"]]] > $static::cookie_expire_time } {
if { $static::debug } {
log local0. "CNotification Done Value: [HTTP::cookie value "NotificationDone"] Expire Time: $static::cookie_expire_time"
}
HTTP::cookie remove "NotificationDone"
HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html" Set-Cookie "NotificationDone=[clock seconds]; path=/; domain=.[HTTP::host]"
}
pool http_pool
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects