Forum Discussion

Geron_149833's avatar
Geron_149833
Icon for Nimbostratus rankNimbostratus
Sep 15, 2014

LTM Maintenance page

Hello everyone. Newbie here wanting more info on iRules and Maintenace Pages. I have my maintenance page working for whenever I go to site.inside.local, but when I try to get any other page to redirect below that site ie. site.inside.local/test/index.html, just gives me a page not found instead of my maintenance page. How can I fix in my iRule below? If I left something out, please let me know so I can clarify. Thanks in advance.

when HTTP_REQUEST {
    if { [active_members [LB::server pool]] < 1} {
 switch [string tolower [HTTP::uri]] {
      "/" {
           HTTP::respond 200 content [ifile get maint_html] "Content-Type" "text/html"
      }
      "/logo.jpg" {
           HTTP::respond 200 content [ifile get logo_jpg] "Content-Type" "image/jpeg"
      }
 }
    }
    }

Geron

8 Replies

  • I think a third switch case is required to cover everything else;

    when HTTP_REQUEST {
     if { [active_members [LB::server pool]] < 1} {
    
      switch [string tolower [HTTP::uri]] {
       "/" {
        HTTP::respond 200 content [ifile get maint_html] "Content-Type" "text/html"
       }
       "/logo.jpg" {
        HTTP::respond 200 content [ifile get logo_jpg] "Content-Type" "image/jpeg"
       }
       default {
        HTTP::respond 200 content [ifile get maint_html] "Content-Type" "text/html"
       }
      }
     }
    }
    
  • Hmmm, well, you'll send the HTML on the first request and the browser should then read that and request the logo graphic subsequently. Can't see why it wouldn't.

     

  • It works fine if I do site.inside.local/. both HTML and logo load.

     

    When I do site.inside.local/test/test.html just the HTML loads now because you told me about the default part. Before I had the default part this would just say page can't be found.

     

  • When I right click on the image on the maintenance page on the subdirectories, it thinks that the image is supposed to be in site.inside.local/test/logo.jpg instead of the root.

     

  • Ahh, so, can you change the HTML to use an absolute URL rather than a relative one. So

    /logo.jpg
    rather than just
    logo.jpg
    .