Forum Discussion

rajendra_106871's avatar
rajendra_106871
Icon for Nimbostratus rankNimbostratus
Mar 19, 2012

irule for the redirection

Dear Friends,

 

 

We configured BIG-IP LTM with webcenter below is the virtual server for the same.

 

 

Aeadebab

 

 

 

When I type aeadebab it should append uri /webcenter or /console and open the desired login page.

 

Below is the iRule we created for the same but it is not working.

 

 

when HTTP_REQUEST

 

if {[HTTP::host] equals "aeadebab"} {

 

{[HTTP::uri] "/webcenter" }

 

}

 

}

 

Please through some light on this.

 

 

 

Thanks,

 

Rajendra.

 

 

  • Hi Rajendra,

    What about trying the following:

    
    when HTTP_REQUEST {
         if {[HTTP::host] eq "aeadebab.adp.ae" } {
             HTTP::redirect "http:://[HTTP::host]/webcenter"
            }
    }
    

    Bhattman

  • Hi Bro,

     

     

    It is not working.

     

     

     

    I Mean it is not redirecting to the specified URI.

     

    It is taking up to aeadebab.adp.ae.

     

     

     

    Thanks,

     

    Rajendra.

     

  • Dear Friends,

     

     

    can some one through some light on this issue.

     

     

     

    Thanks,

     

    Rajendra

     

  • Hi Rajendra,

     

     

    glad to help here. Could you share the current sanatized virtual server config and irule?

     

    Also, to specify the desired behavior, you want users which are connecting to

     

    http://aeadebab.adp.ae to be redirected to http://aeadebab.adp.ae/webcenter ? But the remaining request should be untouched ?

     

    If so, try this one:

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::host] eq "aeadebab.adp.ae" and [HTTP::uri] eq "/" } {

     

    HTTP::redirect "http:://[HTTP::host]/webcenter"

     

    }

     

    }

     

     

    Thanks,

     

    Christian
  • Hi rajendra,

    You could skip the [HTTP::host] value compare if it the desired hostname "aeadebab.adp.ae" is the only one pointed to the Virtual Server and then just handle the redirects.

    If there are multiple hostnames pointed to that Virtual Server, then you will need to include it.

    This iRule will append "/webcenter" to any new connections automatically and is set to append the full URL for any requests beginning in "/console*".

    You can add as many conditions as you like to the switch statement and then add the default pool name that the traffic should be routed to if none of these conditions are met (or change the pool direct to a redirect to another page).

    
    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::uri]] {
    "/" { HTTP::redirect "/webcenter" }
    "/console*" { HTTP::redirect "/console.full.location.url" }
    default { pool pool.name }
    }
    }
    

    Hope this helps.