Forum Discussion

Misbah_Ul_Haq_3's avatar
Misbah_Ul_Haq_3
Icon for Nimbostratus rankNimbostratus
Jan 31, 2018

I am unable to redirect URL on F5 Virtual Appliance please advise

I am unable to redirect URL on F5 Virtual Appliance please advise

I have configured Virtual Server, Pool, Nodes, Monitor, iRule.

ltm virtual SIEBEL_APPLICATION_HTTP_web_http_virtual {

destination 10.50.171.5:http
ip-protocol tcp
mask 255.255.255.255
pool Siebel-Pool-Http
profiles {
    **http** { }
    tcp { }
}
rules {
    **S2T-Redirect**
}
source 0.0.0.0/0
source-address-translation {
    type automap
}
translate-address enabled
translate-port disabled
vs-index 3

}

ltm virtual Testing_Http {

destination 10.50.171.6:http
ip-protocol tcp
mask 255.255.255.255
pool Siebel-Pool-Http
profiles {
    **http** { }
    tcp { }
}
source 0.0.0.0/0
source-address-translation {
    type automap
}
translate-address enabled
translate-port disabled
vs-index 5
}

ltm rule S2T-Redirect {

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] equals "; } {

HTTP::redirect ";

} }

}

Please Advise.....

  • Change below line in your irule

     

    if { [string tolower [HTTP::uri]] equals ";; }

     

    to

     

    if { [string tolower [HTTP::host]] equals "siebel.misali.local" } {

     

    • Misbah_Ul_Haq_3's avatar
      Misbah_Ul_Haq_3
      Icon for Nimbostratus rankNimbostratus

      Hi Prince, No luck. try both type of iRules.

       

      when HTTP_REQUEST {

       

      if { [string tolower [HTTP::host]] equals ";} {

       

      HTTP::redirect ";

       

      }

       

      }

       

  • when HTTP_REQUEST {

    if { [string tolower [HTTP::host]] equals "http://siebel.misali.local"} { 
    HTTP::redirect "http://testing.misali.local" 
    } 
    
    }
    when HTTP_REQUEST {
      if { [string tolower [HTTP::host]] equals "http://siebel.misali.local"} {
        HTTP::respond 301 Location "http://testing.misali.local"
      }
    }
    

    • Stanislas_Piro2's avatar
      Stanislas_Piro2
      Icon for Cumulonimbus rankCumulonimbus

      Hi,

      Both Niels and prince provide you the solution but you still keep http:// in the condition.

      Http Host never contains http://

      Try this

      when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] equals "siebel.misali.local"} {
          HTTP::respond 301 Location "http://testing.misali.local"
        }
      }
      
    • Misbah_Ul_Haq_3's avatar
      Misbah_Ul_Haq_3
      Icon for Nimbostratus rankNimbostratus

      Dear All,

       

      Stanislas Piron, Prince and Niels van Sluis you all are great. My issue resolved with your help.

       

      "siebel.misali.local" has successfully redirected to ";

       

      Thanks a Million.

       

  • Mate... try the following:

    when HTTP_REQUEST {
         if { [string tolower [HTTP::host]] eq "siebel.misali.local" } {
            HTTP::redirect "http://testing.misali.local";
         }
    }