Forum Discussion
Anthony
Sep 13, 2019Nimbostratus
when HTTP_REQUEST {
###############################################
# M E S S A G E T I M E/D A T E #
###############################################
# GMT times/dates for maintenance message set in site-notifcation-times datagroup
set outage_start_time [class search -value site-notification-times equals outage_start_time]
set outage_start_date [class search -value site-notification-times equals outage_start_date]
set outage_end_time [class search -value site-notification-times equals outage_end_time]
set outage_end_date [class search -value site-notification-times equals outage_end_date]
set outage_start_date_full "$outage_start_date $outage_start_time"
set outage_end_date_full "$outage_end_date $outage_end_time"
set startseconds [clock scan $outage_start_date_full]
set endseconds [clock scan $outage_end_date_full]
set now [clock seconds]
set timenow [split [clock format [clock seconds] -format {%H%M} ] " " ]
#log local0. "now = $now | timenow = $timenow"
# Set values to pass to outage page
set end [clock scan $outage_end_date_full]
set day [clock format $end -format {%A}]
set time [clock format $end -format {%R}]
set time_zone [class search -value site-notification-times equals time_zone]
# log local0. "end = $end | day = $day | time = $time | time_zone = $time_zone"
# Check if the current time is before the start and end time
if { $now > $startseconds and $now < $endseconds } {
#log local0. "Site is down - only allowed URLs should work"
# If between start and end times/dates enter site_down function.
# Conditions for page display
if { [HTTP::path] equals "/CheckSessionCookie/ServiceNotificationSiteDownGLP.htm" or
[HTTP::path] equals "/cms/css/core-darwin.css" or
[HTTP::path] equals "/cms/csjs/libs/modernizr-1.7.min.js" or
[HTTP::path] equals "/csjs/predictiveText.js" } {
log local0. "Allow request for: [HTTP::path]"
} else {
log local0. "Sending request for: [HTTP::path] to Site Down page"
#HTTP::respond 302 Location https://[HTTP::host]/CheckSessionCookie/ServiceNotificationSiteDownGLP.htm?day=$day&time=$time&zone=$time_zone
HTTP::redirect "https://[HTTP::host]/CheckSessionCookie/ServiceNotificationSiteDownGLP.htm?day=$day&time=$time&zone=$time_zone"
event disable all
}
} else {
log local0. "Site isn't down right now"
}
}
Here is the code. So the idea is that if its not the page or a resource from the outage page them I expect it to be redirected to the outage page. Seemingly very simple. We run cookie persistence on the VS. The default pool is a set of apache webservers.