Forum Discussion

shawn306_84070's avatar
shawn306_84070
Icon for Nimbostratus rankNimbostratus
Aug 17, 2011

http redirect

I would like to get some help with creating an irule. Here is the scenario.

 

 

Right now users go to a VIP using the following url.

 

 

http://abc.com/Environmental/Login.aspx

 

 

The users are asking to be able to just type abc and have it redirect to the site.

 

 

I have tried following

 

 

when HTTP_REQUEST { if { [HTTP::host] eq "abc" } { HTTP::header replace "Host" "abc.com/Environmental/Login.aspx" } }

 

 

I have not been able to get it work.

 

 

What am I missing ? Or am I totally off base.

 

 

Thanks

 

 

Shawn

 

2 Replies

  • If you want to redirect, you can use this:

    
    when HTTP_REQUEST {
       if {[string tolower [HTTP::host]][HTTP::uri] eq "abc.com/"}{
          HTTP::redirect "http://abc.com/Environmental/Login.aspx"
       }
    }
    

    Aaron
  • Well you see abc doesn't give you an IP address. In the browser it will try to resolve and then fail and then it will try abc.com automatically which does resolve to an IP address. Then it sends the traffic to your VIP. At that point you can add an iRule like above or a class. A class matching host abc.com with a URI of / redirecting to http://abc.com/Environmental/Login.aspx will do what you need if you dont wish to use an iRule.

     

     

    Kevin (Jarvil)