Forum Discussion

dexter_22020's avatar
dexter_22020
Icon for Nimbostratus rankNimbostratus
Aug 26, 2010

redirecting links to a maintenance page on 1 virtual server

Hi,

 

 

Is it possible to have 1 virtual server that has multiple maintenance page for different links? For example:

 

www.domain.com/app1 --> gets data to app_server1

 

www.domain.com/app2 --> gets data to app_server2

 

 

If the links doesn't get 200 OK it goes to a specific maintenance page hosted on a different server.

 

For example:

 

www.domain.com/app1 --> maintenance.domain.com/app1_site

 

www.domain.com/app2 --> maintenance.domain.com/app2_site

 

 

Currently I'm using an iRule:

 

 

when LB_FAILED {

 

if { [active_members [LB::server pool]] !=0 } {

 

} else {

 

HTTP::fallback "HTTP://maintenance.domain.com/app1_site" }

 

}

 

 

 

But this works only for the whole virtual instance www.domain.com.

 

 

Thanks in advance for any info.
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi,

    Something like this should work for you. I'm saving the URI in HTTP_REQUEST as LTM doesn't do this automatically for you.

    
    when HTTP_REQUEST {
    
       set uri [HTTP::uri]
    }
    
    when LB_FAILED {
    
        A load balancing attempt failed.  Check if the current selected pool has any members.
       if { [active_members [LB::server pool]] == 0 } {
    
           Check the requested HTTP URI with wildcard support
          switch -glob $uri {
             "/app1*" {
                 URI started with /app1
                 Save the fallback URI as app1_site
                set uri "app1_site"
             }
             default {
                 URI didn't start with /app1
                 Save the fallback URI as app2_site
                set uri "app2_site"
             }
          }
    
           No active members, so use the dynamically set fallback URL
          HTTP::fallback "HTTP://maintenance.domain.com/$uri"
       }
    }
    

    Aaron