Forum Discussion

Russell_77729's avatar
Russell_77729
Icon for Nimbostratus rankNimbostratus
Dec 24, 2012

Server Maintenance Page

So I have a VS with a pool that contains only one server. I am doing SSL offload to F5. If that one server is down I would like an iRule to display as simple message saying "Sorry, this server is down for mainenance". Any help/direction would be greatly appreciated.

 

6 Replies

  • Something like this should do it;

    
    when HTTP_REQUEST {
    if {[active_members [LB::server pool-name-here]] < 1} {
      HTTP::respond 200 content "Sorry, this server is down for mainenance" noserver Content-Type 
      "text/html" Connection "Close"
      Stop processing the iRule for this event here
      return
      }
    }
    
  • Perfect. What if I was looking for something more elaborate like a full webpage with a couple of images and CSS formatted text?
  • For extra formatting, something like this;

    
    when HTTP_REQUEST {
    if {[active_members [LB::server pool-name-here]] < 1} {
     HTTP::respond 200 content [subst {
      
      Blocking Page
      
      You got blocked buddy. Try using a valid URI, not [HTTP::uri].
      
      
      } ]
    }
    }
    
  • Or for css and images, using iFiles;

    
    iFiles must be uploaded in advance. Note there is no requirement to 
    specify the file extension and thus two files cannot have the same name
    index is a html file, some-image is an image file, requested and sent file
    names do not need to match
    
    when HTTP_REQUEST {
     if {[active_members [LB::server pool]] < 1} {
      switch [HTTP::uri] {
       "/" { HTTP::respond 200 content [ifile get "index"] }
       "/some-image.jpg" { HTTP::respond 200 content [ifile get "some-image"] }
      }
     }
    }