Forum Discussion

aarti_Malhotra_'s avatar
aarti_Malhotra_
Icon for Nimbostratus rankNimbostratus
Jul 24, 2013

irule uri.host -> host/uri redirect help

we are trying following with given irule.

 

 

when HTTP_REQUEST {

 

 

switch [string tolower [HTTP::host]] {

 

"zzz.executiveboard.com" {HTTP::redirect "https://zzz.executiveboard.com/zzzadmin"}

 

"admin.zzz.executiveboard.com" {HTTP::redirect "https://zzz.executiveboard.com/zzzadmin"}

 

"member.zzz.executiveboard.com" {HTTP::redirect "https://zzz.executiveboard.com/zzzmember"}

 

"conversionutility.zzz.executiveboard.com" {HTTP::redirect "https://zzz.executiveboard.com/zzzconversionutility"}

 

}

 

}

 

 

 

We need following rules:

 

1. HTTP request should redirect to HTTPS

 

2. zzz.executiveboard.com and admin.zzz.executiveboard.com should redirect to https://zzz.executiveboard.com/zzzAdmin

 

3. member.zzz.executiveboard.com should redirect to https://zzz.executiveboard.com/zzzMember

 

4. conversionutility.zzz.executiveboard.com should redirect to https://zzz.executiveboard.com/ConversionUtility

 

 

2 Replies

  • Hi Aarti,

    I agree with Kevin. More information on the broken functionality is needed. Like:

    1. Is are these sub-sites "zzzadmin", "zzzmember", and "zzzconversionutility" hosted on the same Virtual Server (VIP) that this iRule is applied on?

    If so, then you need additional logic to prevent a routing loop.

    Example: This will check and see if the URI is blank, if so it will redirect you to the "zzadmin" area. If the URI is not blank, it will send you to the server pool and prevent a routing loop.

    
    when HTTP_REQUEST {
    switch [string tolower [HTTP::host]] {
    "zzz.executiveboard.com" {
    if { [string tolower [HTTP::uri]] equals "/" } {
    HTTP::redirect "https://zzz.executiveboard.com/zzzadmin"
    }
    else {
    pool target.server.pool
    }
    }
    }
    }
    

    2. What you have listed in the iRule and in your comments is different. For RFC Compliant browsers the [HTTP::host] or "www.website.com" portion is NOT case-sensitive, but the [HTTP::uri] portion IS case-sensitive depending on the Operating System that the site is hosted on.

    In your iRule you have "zzzadmin", "zzzmember", and "zzzconversionutility", but in your comments you specify "zzzAdmin", "zzzMember", and "ConversionUtility". Correcting the capitalization in your URI could very well be your issue depending upon your research into the exact failure in functionality.

    Hope this helps.