Forum Discussion

Ram_63318's avatar
Ram_63318
Icon for Nimbostratus rankNimbostratus
May 29, 2008

Redirection

I am trying to redirect 216.23.166.46(VIP) to "http://216.23.166.46/livenation" but so far I am doing something wrong where it wouldn’t redirect or it redirects but I get the page cannot be displayed messaged. If I go to 216.23.166.46 directly I get some default page but the customer want to redirect to "http://216.23.166.46/livenation" when someone just types 216.23.166.46. I have tried to accomplish this by creating HTTP Class profile but I am doing something wrong. Can this be done using iRule?
  • Got this working!!!! Used irule

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] equals {/}} {

     

    HTTP::uri {/livenation}

     

    }

     

    }

     

     

    -Ram
  • How about for HTTPS?

     

     

    Redirect https://vipnation to https://vipnation/livenation

     

     

    Thanks,

     

    Ram
  • Sorry I meant redirecting https://vipnation.com to https://vipnation.com/livenation
  • Colin,

     

     

    I have HTTPS virtual server but when i go to https://vipnation.com or https://www.vipnation.com it should be redirecting to https://vipnation.com/livenation/ but it doesn't seem to be working.

     

     

    It works for HTTP virtual server.When I go to http://vipnation.com it does redirect to http://vipnation.com/livenation/

     

     

    irule that i am using for HTTPS virtual server would be

     

     

    when HTTP_REQUEST {

     

    if { ! ([string tolower [HTTP::uri]] starts_with "/livenation") } {

     

    HTTP::redirect "https://[HTTP::host]/livenation"

     

    }

     

    }

     

     

    I am pretty sure that I am doing something wrong here because if go to the server directly https://206.82.216.130/livenation it works fine.

     

     

    Please let me know if you see something wrong here.

     

     

    Thank you,

     

    Ram Tangella
  • For time being I have changed few things and I got it working but SSL certificate that's installed on the server wouldn't show up by doing the following. Instead it just shows localcompany information when I click on the Lock.

     

     

    I modified the irule to the following:

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] equals {/}} {

     

    HTTP::redirect "https://vipnation.com/livenation/php/login.php"

     

    }

     

    }

     

     

    Also I am using the HTTP_POOL instead of HTTPS pool members (They are same servers but listening on different ports for each pool). If I don't use the HTTP_POOL it wouldn't redirect at all and I get page cannot be displayed.

     

     

    Not sure what is going on here....

     

     

    -Ram
  • My Final Post:

     

     

    Customer has one server behind the load balancer. Listening on port 443 and port 80. Customer has installed SSL cert on this server.

     

     

    Customer wants all his http to be redirected to https as well. Basically if a user types http://vipnation.com or www.vipnation.com or 216.23.166.46 load balancer should redirect to https://vipnation.com/livenation/php/login.php

     

     

    I have two virtual servers (one for port 80 and port 443)

     

    I have two pools (HTTP_Member & HTTPS_Member)

     

    I have clientssl enabled for virtual server (SSL) and not for the HTTP virtuals

     

    I have two irules one for the http virtuals and one for https virtuals

     

     

    when HTTP_REQUEST {

     

    if { ! ([string tolower [HTTP::uri]] starts_with "/livenation") } {

     

    HTTP::redirect http://[HTTP::host]/livenation

     

    }

     

    }

     

     

    Above irule works fine for redirecting http to http

     

     

    when HTTP_REQUEST {

     

    if {[HTTP::uri] equals {/}} {

     

    HTTP::redirect "https://vipnation.com/livenation/php/login.php"

     

    }

     

    }

     

     

    Above irule doesn't work. This is where it should redirect all the http traffic including the https to traffic to https://vipnation.com/livenation/php/login.php

     

     

    Also the other thing is that the customer has installed ssl cert on the server and when the load balancer redirects http requests the user should be able to see the correct company that issued the ssl cert.

     

     

    To test....if you go to the server directly...it works https://206.82.216.130/livenation we want the same to happen when going to www.vipnation.com

     

     

    NOTE: Please ignore my previous posts

     

     

    Thank you,

     

    Ram Tangella