Forum Discussion

SP_SINGH_279526's avatar
SP_SINGH_279526
Icon for Nimbostratus rankNimbostratus
Aug 25, 2016

IRULE for Maintenance page

For my client there is 3 Portal behind virtual server. Whenever client manually down any of the portal , that portal generate error 500. Other 2 portal works fine at the same time.I am looking to iRule which generate specific iFile for specific portal returning error 500.

Portal are :

https://stibo-portalv.kfplc.com/portal/sfxsupplier

https://stibo-portalv.kfplc.com/portal/sfxuser

https://stibo-portalv.kfplc.com/portal/sfxphotographer

Existing iRule need to modified :

when HTTP_REQUEST {

set hostvar [HTTP::host]

set urivar [HTTP::uri]

set VSPool [LB::server pool]

  if {([active_members $VSPool] < 1) && !([HTTP::uri] starts_with "/portal/sfx") } { 

HTTP::respond 200 content [ifile get stibo_all_opco]

}

if {([active_members $VSPool] < 1) && ([HTTP::uri] starts_with "/portal/sfx") } {

HTTP::respond 200 content [ifile get stibo_SFX]

}

}

My Modification no working is :

when HTTP_REQUEST {

set hostvar [HTTP::host]

set urivar [HTTP::uri]

set VSPool [LB::server pool]

if {([active_members $VSPool] < 1) && !([HTTP::uri] starts_with "/portal/sfx") } {

set check_response 0

HTTP::respond 200 content [ifile get stibo_all_opco]

}

if {([active_members $VSPool] < 1) && ([HTTP::uri] starts_with "/portal/sfx") } {

set check_response 1

}

} when HTTP_RESPONSE {

if {($check_response==1) && ([HTTP::status] == 500) }{

HTTP::respond 200 content [ifile get stibo_SFX]

}

}

3 Replies

  • Hi,

    can you test this irule:

    when HTTP_REQUEST {
        if {([HTTP::uri] starts_with "/portal/sfx")} {
            set responsepage [ifile get stibo_SFX]
        } else {
            set responsepage [ifile get stibo_all_opco]
        }
        if {([active_members [LB::server pool]] < 1) } {
            HTTP::respond 200 content $responsepage
        }
    }
    } when HTTP_RESPONSE {
        if {[info exists responsepage] && ([HTTP::status] == 500) }{
            HTTP::respond 200 content $responsepage
        }
    }
    
  • Hi SP_SINGH,

     

    please flag Stanislas answer with the "Accept this answer" functionality. This will help other devcentral users to identify already solved questions. ;-)

     

    Thanks and Cheers, Kai