Forum Discussion
Gill_32697
Nimbostratus
Jan 20, 2015sorry page redirect
Im trying to do a sorry page redirect for two conditions. First if the formatted page can be reached at the server then do the redirect, but is if there is a network failure and I cant reach the serv...
shaggy
Nimbostratus
Jan 20, 2015there are a few issues with the iRule as-is
- In the description, you mentioned sending a redirect to the formatted page on the server if the formatted page can be reached, but in the example there is nothing verifying that the formatted page is available
- The HTTP_REQUEST event cannot check for response content - HTTP_RESPONSE is more fitting
- The syntax used to send the response is wrong
To address the first point - I would create a monitor to check the status of the server's sorry-page and apply it to a new pool that only contains the sorry-server:
ltm monitor http down_pool_mon {
defaults-from http
destination *:*
interval 5
timeout 16
recv "200 OK"
send "GET /_default.html HTTP/1.1\r\nHost: www.siterequest.com\r\nConnection: Close\r\n\r\n"
time-until-up 0
timeout 10
}
ltm pool down_pool {
load-balancing-mode round-robin
members {
10.10.10.10:80 {
address 10.10.10.10
session monitor-enabled
state up
}
}
monitor down_pool_mon
}The associated iRule:
when HTTP_RESPONSE {
check server response code - if 404, perform sorry-activity
if { [HTTP::status] contains "404"} {
check availability of formatted-sorry-page on sorry-server
...by checking number of active members in down_pool
if there is at least 1 active member, send redirect to sorry-page
if no members in down_pool, send HTTP response from F5
if { [active_members down_pool > 0 } {
HTTP::redirect "http://www.siterequest.com/_default.html"
} else {
HTTP::respond 503 noserver content "Site Temporarily UnavailableWe are sorry, but the site you are looking for is temporarily out of service If you feel you have reached this page in error, please try again."
}
}
}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