Forum Discussion

Manoj_129792's avatar
Manoj_129792
Icon for Nimbostratus rankNimbostratus
Nov 04, 2016
Solved

need help to write an IRULE.

Hello All,

 

I have two vips configured 148.x.x.228:443 and 148.x.x.228:80.

 

with 148.177.29.248:80 Irule "when HTTP_REQUEST { HTTP::redirect https://[HTTP::host][HTTP::uri] }" associated to redirect all http request to 148.x.x.228:443

 

Now i want to create new i rule which i need to associate with pool under VIP 148.x.x.228:443

 

1-

 

2-

 

3-https://order360.jnjgateway.com/eIFU/CustomError.html

 

if first URL is not working then it must redirect to third URL. if second URLis not workinh then its must redirect to third URL.

 

can we achieve this with single iRULE.?

 

Regards Manoj

 

  • Try this irule. Hope it will work as per requirement.

    when HTTP_REQUEST { 
    if { [active_members [LB::server pool]] == 0 } { 
                    HTTP::redirect "https://order360.jnjgateway.com/eIFU/CustomError.html" } 
        else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
    } 
    

3 Replies

  • Try this irule. Hope it will work as per requirement.

    when HTTP_REQUEST { 
    if { [active_members [LB::server pool]] == 0 } { 
                    HTTP::redirect "https://order360.jnjgateway.com/eIFU/CustomError.html" } 
        else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
    } 
    
    • Manoj_129792's avatar
      Manoj_129792
      Icon for Nimbostratus rankNimbostratus

      do i need to define the name of pool in place of "server pool".

       

      when HTTP_REQUEST { if { [active_members [LB::Site-148.x.x.x_4001]] == 0 } { HTTP::redirect "; } else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }

       

    • Samir_Jha_52506's avatar
      Samir_Jha_52506
      Icon for Noctilucent rankNoctilucent

      No need to define pool name, it will take default pool which is tagged to VIP. If you want then use below option.

         if { [active_members POOL-NAME] == 0 }