Forum Discussion

SysAdmins_23367's avatar
SysAdmins_23367
Icon for Nimbostratus rankNimbostratus
Apr 09, 2010

can't get HTTP::redirect to work

I'm attempting to make a simple iRule which will redirect a user with a defined IP address and allow everyone else who connects to the default pool. The problem is that everytime I associate the following iRule to my virtual server I get a "page cannot be displayed" error. Even if I'm connecting from an IP which is not 192.168.98.232 I still get the page cannot be displayed error. I am able to access http://192.168.30.53/index.html directly from my PC and the F5 so it's not a firewall issue. Any help would be greatly appreciated.

 

 

when HTTP_REQUEST {

 

if { [[IP::client_addr] equals 192.168.98.232]}

 

{ HTTP::redirect http://192.168.30.53/index.html }

 

else { forward }

 

}

1 Reply

  • If you check the /var/log/ltm log file, you should see runtime TCL errors indicating an invalid command of 1 or 0. If you add the IP::addr command it should work fine:

    
    when HTTP_REQUEST {
       if { [IP::addr [IP::client_addr] equals 192.168.98.232]}{
          HTTP::redirect "http://192.168.30.53/index.html"
       }
    }
    

    Note that the forward command will cause LTM to forward the request without load balancing to the VIP's default pool. The destination address won't be translated. So you can remove the else clause and then LTM will use the VIP's default pool for any non-matching IP.

    Aaron