Forum Discussion

Brian_Mayer_841's avatar
Brian_Mayer_841
Icon for Nimbostratus rankNimbostratus
Apr 27, 2007

Domain redirect not working for non *.com domain

Hi,

 

 

We've added a section to our domain redirect iRule and it just will not redirect as expected. It actually tries loading pages (I see HTTP 200 responses and ojbects loading into the browser, but no 302 redirect to other domain specified).

 

 

However, when I put the same IIS redirect on the web server, the browser is sent to the correct URL. F5 Support seems to think the syntax of the iRule below looks good, and directed me here.

 

 

Can you guys help?

 

 

Thanks,

 

Brian

 

 

 

iRule:

 

==============

 

when HTTP_REQUEST {

 

switch -glob [HTTP::host] {

 

"*invitrogen.com.cn" {

 

HTTP::redirect "http://www.invitrogen.com/getgid.cfm?gid=197&returnURL=content.cfm?pageid=1"

 

}

 

}

 

}

 

==============

 

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Hi Brian --

    Try logging the value of the host header to verify your match values:
    when HTTP_REQUEST {
      log local0. "Host: [HTTP::host]"
      switch -glob [HTTP::host] {
        "*invitrogen.com.cn" {
          log local0. "Host matches *invitrogen.com.cn: Redirecting"
          HTTP::redirect "http://www.invitrogen.com/getgid.cfm?gid=197&returnURL=content.cfm?pageid=1"
        }
      }
    }

    /deb
  • Figured I'd let you all know I figured out the problem. It was user error. The iRule was fine, I was trying to access the wrong VS when testing it. Thanks for the help.

     

     

    -Brian