Forum Discussion

Shailesh's avatar
Shailesh
Icon for Nimbostratus rankNimbostratus
Oct 12, 2020

I rule for maintenance page

Hi Team,

 

Need assistance to fix an I rule. Below are the requirements:

1) If VS works fine then any traffic matching URI " N=197" & "Nrpp=25 "needs to re-directed as usual.

2) When all the Pool members are down " N=197" URI need to re-direct to ABC maintenance page and URI "Nrpp=25 " needs to be redirected to XYZ URL

 

I have tried with few I-rules but not getting expected response. I am not able to re-direct to maintenance pages for both the URI's.

 

My I-rule:

 

when HTTP_REQUEST {

  if { [active_members [LB::server pool]] == 0 && [[HTTP::uri] contains "N=197"] } {

   HTTP::redirect "https://d-www.abc.com/system-maintenance"

  }

elseif { [active_members [LB::server pool]] == 0 && [[HTTP::uri] contains "Nrpp=25"] } {

   HTTP::redirect "http://s-www.xyz.com/maintenance/index.html"

  }

}

 

or I-rule :

when HTTP_REQUEST {   

  if { ( [[active_members [LB::server pool]]] < 1 ) & & ( [[HTTP::uri] contains "N=197"] ) } {    

   HTTP::redirect "https://d-www.abc.com/system-maintenance"

  }

elseif { ( [[active_members [LB::server pool]]] < 1 ) & & ( [[HTTP::uri] contains "Nrpp=25"] ) } {    

   HTTP::redirect "http://s-www.xyz.com/maintenance/index.html"

  }  

}

  • Hi Shailesh,

    Can you try this iRule and look logs?

    when HTTP_REQUEST {
    	if { [active_members [LB::server pool]] < 1 } {
    		log local0. "All members down. URI=[HTTP::uri]"
    		switch -glob [string tolower [HTTP::uri]] {
    			"*n=197*" { HTTP::redirect "https://d-www.abc.com/system-maintenance" }
    			"*nrpp=25*" { HTTP::redirect "http://s-www.xyz.com/maintenance/index.html" }
    		}
    	}
    }
  • Thanks a lot for the response, this I-rule did fix the problem.