Forum Discussion
Editing iRule for Maintainance Page with image local in F5 Big-IP iFile
Try this out
when HTTP_REQUEST {
# Check if all members of the pool are down
if { [active_members [LB::server pool]] == 0 } {
HTTP::respond 503 content "
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Maintenance Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: rgb(27, 131, 111);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
text-align: center;
}
.container {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h1 {
font-size: 2em;
margin: 0;
}
p {
font-size: 1.2em;
}
.logos {
margin-bottom: 20px;
}
.logos img {
height: 120px;
margin: 0 15px;
}
.gear-icon {
font-size: 3em;
color: rgb(27, 131, 111);
}
@media (max-width: 600px) {
h1 {
font-size: 1.5em;
}
p {
font-size: 1em;
}
}
</style>
</head>
<body>
<div class='container'>
<div class='logos'>
<!-- Reference iFiles using /iFiles/URIs -->
<img src='/iFiles/Blackboard-LOGO' alt='Blackboard Logo'>
<img src='/iFiles/PSAU-LOGO' alt='PSAU Logo'>
</div>
<h1>We'll be back soon!</h1>
<p>Our website is currently undergoing maintenance. We are working to improve your experience. Stay tuned!</p>
<p>! الموقع حاليا تحت الصيانة, نحن نعمل بجد لتحسين تجربة المستخدم، ترقبوا</p>
<div class='gear-icon'>⚙️</div>
</div>
</body>
</html>
" "Content-Type" "text/html"
} else {
# Handle requests for iFiles (images)
switch [HTTP::uri] {
"/iFiles/Blackboard-LOGO" {
HTTP::respond 200 content [ifile get "Blackboard-LOGO"] "Content-Type" "image/png"
}
"/iFiles/PSAU-LOGO" {
HTTP::respond 200 content [ifile get "PSAU-LOGO"] "Content-Type" "image/png"
}
default {
# Optionally handle requests for other paths (if needed)
}
}
}
}
Hi f51,
Thank you and I appreciate your assistance. As noted in the previous response, I have successfully tested the iRule code with iFile. This implementation not only enhances efficiency but also improves the structure, as evidenced by the shorter iRule code compared to the previous version.
Regards
Omran Mohamed
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