Forum Discussion

Parag_Unadkat_2's avatar
Parag_Unadkat_2
Icon for Nimbostratus rankNimbostratus
Mar 29, 2016

Hosting a Maintenance page - v11.6

I am looking for a possible solution for hosting a static web page with images using iFile and iRule with the requirement as per below.

 

Virtual Server IP: 192.168.1.1 Pool Name: test_pool Pool Members: 10.1.1.1 and 10.1.1.2 HTTP page name do be deployed on LTM: "maintenance.html" F5 in not configured in load balancing mode.

 

Requirement:

 

  1. Virtual has a 2 pool member, if both pool members goes down, it should present Down 4 Maintenance web page
  2. If there are no virtual ( only iRule assigned to virtual ),it should still present Down 4 Maintenance web page.
  3. If you disable/force offline all pool members manually, it should still present down 4 maintenance web page.
  4. I have a .doc file with images which I have converted to maintenance.html, does it still require image to be uploaded ?

Could some one pls suggest me sample which I can follow?

 

Thank you !

 

6 Replies

  • I have done a lot of maintenance page stuff with F5, and from my experience, it's always better to issue a redirect to external splash page service instead of responding with static iFile object (HTML page) from F5 itself. Problem with static iFiles is that you will have to keep them updated manually yourself whereas with an external splash page service, you can give full control to your application/release team(s).

     

    You can refer to my own solution and modify this as needed. Let me know if you have any questions.

     

     Consider iRule execution priority if you have other iRules to avoid TCL errors (multiple redirect/response invocation type errors in particular).
     Also consider general execution order. For instance, if you use mobile-user redirect iRules (which take end-users to another service), it would not make sense to display splash page to them, therefore, you should reduce the priority of a mobile-redirect iRule to 299 or less to make sure it's executed before this iRule.
    
    priority 300
    
    when HTTP_REQUEST {
    
       Change value to 1 to manually force maintenance page redirect/response.
      set manualSplash 0
    
       Do not modify this setting
      set splashBypass "false"
    
      if { ([class match [IP::client_addr] equals "data_ip_maintenance_bypass"]) } {
         Data-group: data_ip_maintenance_bypass includes IP addresses of company offices, and external collaborators responsible for functional release testing and validation. A splash page redirect/response will be suppressed for them at all times.
        set splashBypass "true"
      } elseif { ( [HTTP::header value "Via"] contains "llnw" ) || ( [HTTP::header value "Via"] contains "akamai" ) }{
         Splash page redirect/response should be suppressed in case of CDN requests too. (You can remove this elseif section if you do not use CDN)
        set splashBypass "true"
      }
    
    
      if { (( [active_members [LB::server pool]] < 1 || $manualSplash == 1) && ( $splashBypass == "false" )) } {
         Redirect to splash page service, or respond with a static iFile object (HTML splash page) from F5.
         Comment out 302 code response for a splash redirect, else comment out 200 code response for bigip iFile object response
         Note that it's always better to execute redirect to a dedicated splash-page service
    
         HTTP::respond 302 location "http://splash.mydomain.com/out-of-service" Cache-Control no-cache Connection Close
         HTTP::respond 200 content [ifile get splash.html] "Content-Type" "text/html" Cache-Control no-cache Connection Close
        event disable
      }
    }
  • I have done a lot of maintenance page stuff with F5, and from my experience, it's always better to issue a redirect to external splash page service instead of responding with static iFile object (HTML page) from F5 itself. Problem with static iFiles is that you will have to keep them updated manually yourself whereas with an external splash page service, you can give full control to your application/release team(s).

     

    You can refer to my own solution and modify this as needed. Let me know if you have any questions.

     

     Consider iRule execution priority if you have other iRules to avoid TCL errors (multiple redirect/response invocation type errors in particular).
     Also consider general execution order. For instance, if you use mobile-user redirect iRules (which take end-users to another service), it would not make sense to display splash page to them, therefore, you should reduce the priority of a mobile-redirect iRule to 299 or less to make sure it's executed before this iRule.
    
    priority 300
    
    when HTTP_REQUEST {
    
       Change value to 1 to manually force maintenance page redirect/response.
      set manualSplash 0
    
       Do not modify this setting
      set splashBypass "false"
    
      if { ([class match [IP::client_addr] equals "data_ip_maintenance_bypass"]) } {
         Data-group: data_ip_maintenance_bypass includes IP addresses of company offices, and external collaborators responsible for functional release testing and validation. A splash page redirect/response will be suppressed for them at all times.
        set splashBypass "true"
      } elseif { ( [HTTP::header value "Via"] contains "llnw" ) || ( [HTTP::header value "Via"] contains "akamai" ) }{
         Splash page redirect/response should be suppressed in case of CDN requests too. (You can remove this elseif section if you do not use CDN)
        set splashBypass "true"
      }
    
    
      if { (( [active_members [LB::server pool]] < 1 || $manualSplash == 1) && ( $splashBypass == "false" )) } {
         Redirect to splash page service, or respond with a static iFile object (HTML splash page) from F5.
         Comment out 302 code response for a splash redirect, else comment out 200 code response for bigip iFile object response
         Note that it's always better to execute redirect to a dedicated splash-page service
    
         HTTP::respond 302 location "http://splash.mydomain.com/out-of-service" Cache-Control no-cache Connection Close
         HTTP::respond 200 content [ifile get splash.html] "Content-Type" "text/html" Cache-Control no-cache Connection Close
        event disable
      }
    }
    • Parag_Unadkat_2's avatar
      Parag_Unadkat_2
      Icon for Nimbostratus rankNimbostratus
      Thanks Hannes ! This is really good options. With the environment, we are looking only to host a same static page without much modification with some organisation logo for all sites. I found below artical which is very close to the requirement which I am trying to achieve https://devcentral.f5.com/s/articles/v111ndashexternal-file-access-from-irules-via-ifiles