Forum Discussion

KJ_50941's avatar
KJ_50941
Icon for Nimbostratus rankNimbostratus
Sep 29, 2015

how can I add logo to ifile and irule

Hope it clear .I was able to display 503 error once pool members are down, using iFile and irule, but it is very plain Text, and would like to add logo to it. how can I add logo to ifile ?below is the ifile and irule,

 

this is my ifile:

 

 

The system is unable to fulfill your request. This is not a problem with your computer or network connection. Try again later.

 

this is irule.

 

when HTTP_REQUEST { if { [active_members My_DEV_7443_Pool ] < 1 } { HTTP::respond 503 content [ifile get 503-error-irule ] else { discard event disable TCP::close } } }

 

3 Replies

  • do I need to load image on F5? how do I refer to it from irule ?

     

    • PeteWhite's avatar
      PeteWhite
      Icon for Employee rankEmployee
      You put a link pointing to where it's stored preferably. This may mean you need to store it somewhere first of course. You can also base64 encode the image and send that to the browser in the html of the iFile. I'll leave you to google how to do that.
  • A sorry page served from the F5 is usually best

    • a self-contained HTML with embedded images/js OR
    • can have resources served from a domain other than the domain for which you are displaying the sorry page OR
    • can be a 302 redirect to a sorry page on another domain

    If you wanted to serve a sorry page and someone else produces it for you and puts it on a webserver for you, you can scoop it up like this and store it as an ifile ;

    curl -H "Accept-Encoding:gzip" http://10.9.8.7/sorry.html > /var/class/sorry_html    
    tmsh create sys file ifile "sorry_html" source-path file:/var/class/sorry_html
    tmsh create ltm ifile "sorry_html" file-name "sorry_html"
    

    I tend to use LB_FAILED to serve a page myself as it covers all failure modes, not just when all pool members down;-

    when LB_FAILED {
        HTTP::respond 503 -version 1.1 content [ifile get "sorry_html"] noserver Accept-Encoding "gzip" Content-Type "text/html;charset=utf-8" Retry-After "300" noserver
    }
    

    If you wanted to serve an image scoop it up from server like this;

    tmsh create sys file ifile "myimage_png" source-path http://10.9.8.7/myimage.png
    tmsh create ltm ifile "myimage_png" file-name "myimage_png"
    

    then in the iRule to display the image;-

    HTTP::respond 200 -version 1.1 content [ifile get "myimage_png"] noserver Content-Type "image/png" noserver