18-Jan-2018 00:28
Hi All
I have created the below iRule for a Maintenance page
The page is loading successfully however. I am however the following issues: - The maintenance page is rendered even if there are servers available in the Pool, thus always showing the page - when accessing the site http://mysite.com/ the maintenance page loads, however when users are accessing stored pages that have URI included, example http://myexample.com/uri it tries to load the page and we get page cannot be displayed error. How do I resolve that if the user is using a URI or not that they get the maintenance page if servers are offline?
Any assistance will be greatly appreciated.
Thanx SL
18-Jan-2018
00:56
- last edited on
14-Dec-2022
11:40
by
JimmyPackets
It's a little hard to read your irule, are you able to copy the text rather than a screen shot?
I would try to define exactly the pool you want to check, rather than relay on [LB::server pool] and specify the number of active members being less than one, as being the condition in the 'if' statement.
[active_members my_pool] < 1
Can you give an example of the URI requests that aren't working based on your code
18-Jan-2018
01:08
- last edited on
14-Dec-2022
11:41
by
JimmyPackets
You can't use the if statement where you have placed it inside the switch.
if {[active_members [LB::server pool]] < 1 } {
switch -glob ....
21-May-2020 17:42
Has anyone found a solution for this issue? The problem for me is not the active pool is the path, usually refer to a file or folder (directory) on the webserver (for example “/folder/file.html”), to hostname shows all the images and background of the maintenance page but not using a path link.
21-May-2020 19:03
Find out that adding extra lines with the path and the image makes the uri show the images on the path too.
http://abc.com
http://abc.com/xyz
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
switch -glob [HTTP::uri] {
"/logo.png" {HTTP::respond 200 content [ifile get "logo"]}
"xyz/logo.png" {HTTP::respond 200 content [ifile get "logo"]}
default { HTTP::respond 200 content [ifile get index] noserver "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate" }
}
}
}
27-May-2020
04:43
- last edited on
14-Dec-2022
11:41
by
JimmyPackets
I can recommend to use base64 for images...
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1 } {
HTTP::respond 503 content {
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Error 503 Service Unavailable</title>
</head><body>
<img src="data:image/png;base64,yourbase64codehere" alt="Logo">
<h1> Service Unavailable </h1>
<p>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.</p>
</body>
</html>
}
}
}