Forum Discussion
LTM V10.2 - Splash Page image file
Hi folks!
I have a requirement where the BIG-IP LTM has to present the user with a splash page (image file) when all of their servers are offline. Base on some previous dev central threads, looks like it can be done by converting the image file to base64 format and placing this encoded string into a iRule group and then access it using an iRule.
I have successfully decoded the base64 string back to the image file using a tool just to verify that the base64 string is valid.
Here is how my iRule looks to test out the image file on the browser.
when HTTP_REQUEST {
HTTP::respond 200 content [b64decode [lindex $::Test_Lab_Splash_Page_Group 0]] "Content-Type" "image/png"
}
Following is the error that I see in the log file.
01220001:3: TCL error: Test_Lab_Splash_Page - conversion error invoked from within "b64decode [lindex $::Test_Lab_Splash_Page_Group 0]"
- Stefan_KlotzCumulonimbus
Hi Bhanu,
you are on the right way. I also played with similar requirements in the past, but I always put in the base64 string directly into the iRule. Something like this:
when HTTP_REQUEST { if { [active_members ] < 1 } { switch [string tolower [HTTP::uri]] { "/maintenance/logo.gif" { HTTP::respond 200 content [b64decode ""] "Content-Type" "image/gif" } "/maintenance/index.html" { HTTP::respond 200 content "" } default { HTTP::redirect "http://[HTTP::host]/maintenance/index.html" } } } elseif { [string tolower [HTTP::uri]] eq "/maintenance/index.html" } { HTTP::redirect "http://[HTTP::host]" } }
Please give it a try this way.
btw. I'm using this URL to base64 encode pictures.
Ciao Stefan 🙂
- Bhanu_9561Cirrus
Stefan,
Thanks for your reply!
Looks like the BIG-IP version 10.2.0 has some issues accessing the elements in a datagroup using the $:: prefix in the iRule. I found these links in devcentral and used the class file instead to make it work.
Basically put the base64 image into a file in the /var/class/ directory and accessed it using the iRule.
https://devcentral.f5.com/questions/problem-with-b64decode-lindex-in-version-1021 https://devcentral.f5.com/wiki/iRules.class.ashx
Bhanu
- Sreenivasa_PNimbostratusThanks, Bhanu. for the useful info
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