Forum Discussion
Editing iRule for Maintainance Page with image local in F5 Big-IP iFile
Hi Omran,
Below is the approach that I personally use when creating a maintenance page. It involves creating 3 x iFiles on the BIG-IP; one for your maintenance page HTML, and two others for your logo images. You can then use a switch glob statement to get the BIG-IP to display these files.
Steps
1. Grab all of your maintenance page HTML code and save it into a new file named "maintenance.html"
2. Import maintenance page as an iFile:
a) Import file in "System iFile List" via GUI: System > File Management > iFile List > Import
b) Create iFile in "iRule iFile List" via GUI: Local Traffic > iRules > iFile List
3.Create iRule and apply to virtual server
when HTTP_REQUEST {
if { [active_members [LB::server pool]] == 0 } {
switch -glob [HTTP::uri] {
"*Blackboard-LOGO" { HTTP::respond 200 content [ifile get "Blackboard-LOGO"] "Content-Type" "image/png" "Cache-Control" "no-cache" "Connection" "Close" }
"*PSAU-LOGO" { HTTP::respond 200 content [ifile get "PSAU-LOGO"] "Content-Type" "image/png" "Cache-Control" "no-cache" "Connection" "Close" }
default { HTTP::respond 503 content [ifile get "maintenance.html"] "Content-Type" "text/html" "Cache-Control" "no-cache" "Connection" "Close" }
}
}
}
If you try this, let me know whether or not this works for you.
Cheers,
Michael
- FaresnaniFeb 20, 2025
Altostratus
Dear Michael,
Thank you for your support and detailed explanation, unfortunately, it didn't work for me I got the below result
- Feb 20, 2025
Hi Omran,
Apologies, I have updated the the iRule code in my original reply (I was referencing the $URI variable which I did not declare). This should hopefully be fixed now, Please try copying and pasting the iRule again.
- FaresnaniFeb 20, 2025
Altostratus
Hi Michael,
Thank you for your support and thorough explanation; it has greatly enhanced my understanding of how to use iRule with iFile.
Initially, I encountered difficulties, likely due to my limited coding experience. However, your expertise and suggestions, combining it with AI, helped resolve the issue. below is the result
I sincerely appreciate your assistance
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