Forum Discussion

Anthony_1648's avatar
Anthony_1648
Icon for Nimbostratus rankNimbostratus
Jul 27, 2010

configuring URL redirection from a Virtual Server

I'm not sure if this is possible, but here is what I'm trying to do. I'm trying to redirect URLs using my LTM's instead of using MS IIS. For example I want www.mydomain.com redirected to www.mydomain.com/cooltopic/index.html or even www.yourdomain.com/example/test.html. The only way I could think about doing this (which may be incorrect) is by setting up a Virtual Server then applying an iRule to do the redirection. I have tried that and its not working, I'm not sure if its because its not possible or I'm doing something wrong. I setup the VS with IP 10.10.10.10 (example) I don't have any pools or anything configured then I apply an iRule. I point the domain name that I want redirected to the IP 10.10.10.10, I allow it through my firewall and all I get is page cannot be displayed. I can ping the IP from the outside and verify that its getting to the LTM, but nothing gets redirected. I have attached the iRule at the end of the post.

 

 

Is this the proper way to do a URL redirect with the F5? If it is I hope someone can give me some advice as to what I'm doing wrong and if its not the proper way I would appreicate if someone can show me.

 

 

 

Irule:

 

when HTTP_REQUEST { if {[HTTP::uri] equals {www.mydomain.net}} {HTTP::uri {www.yourdomain.com/test/mobile-printing-solutions.aspx} } }

 

1 Reply

  • Hi Anthony,

    I'd start with adding debug logging to the iRule so you can see the values you're checking and make sure they return values you're expecting. You can do this with the log command and checking the /var/log/ltm file for the output. Once you give that a try, can you test something like this?

    
    when HTTP_REQUEST {
       log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
       if {[string tolower [HTTP::host]] equals {www.mydomain.net}} {
          log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to http://www.yourdomain.com/test/mobile-printing-solutions.aspx"
          HTTP::redirect {http://www.yourdomain.com/test/mobile-printing-solutions.aspx}
       }
    }
    

    Aaron