For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

krish_net_18726's avatar
krish_net_18726
Icon for Nimbostratus rankNimbostratus
Aug 31, 2015

How to configure a i-rule with image (company logo) on it

HI all,

Need help to create a i-rule for maintenance page with image that should come whenever the website is down.

We do have maintenance page configured but w/o image. Please find the same & suggestions please.

::

If the all members in the default pool are down, redirect to the maintenance page

when LB_FAILED { if { [active_members [LB::server pool ]] <1 } {

HTTP::respond 200 content { Website Under Maintenance

Down For Maintenance

"We sincerely apologize for the inconvenience.Our Site is currently undergoing scheduled maintenance and upgrades,but will return shortly.Thank you for your patience." xyz.com.

}

}

} ::

Thanks in advance.

2 Replies

  • If you have APM, you could use Hosted Files.

     

    If not, I see that you're referencing a CSS file. Could you host the image in the same folder as the CSS file (unless the css file isn't working either). Otherwise, you could consider embedding the image in the response content using the data uri scheme. You can convert an image to its PNG data with a site like this one.

     

  • What about this?

     

    when HTTP_REQUEST {       
        if { [active_members ] < 1 } {
            switch [string tolower [HTTP::uri]] {
                "/maintenance/logo.gif" {
                    HTTP::respond 200 content [b64decode "Base64 decoded Image string"] "Content-Type" "image/gif"
                }
                "/maintenance/index.html" {
                    HTTP::respond 200 content "html-code of the sorrypage (escape all ")"
                }
                default {
                    HTTP::redirect "https://[HTTP::host]/maintenance/index.html"
                }
            }
        } elseif { [string tolower [HTTP::uri]] eq "/maintenance/index.html" } {
            HTTP::redirect "https://[HTTP::host]"
        }
    }
    

    If you are using external CSS or even JavaScript files, we prefer to include everything in a single HTML-file. For the image you can also use something like this:

     

    
    

    Hope that helps you and/or point you in the right direction.

     

    Ciao Stefan 🙂