Forum Discussion

Matt_A_184631's avatar
Matt_A_184631
Icon for Nimbostratus rankNimbostratus
Feb 27, 2015
Solved

HTTP Redirect from intranet to internet site

I am wanting to create a redirect using and internal DNS name that redirects to an external one. EX: http://internal.mycompany.com redirects to http://mycompany.f5.com

 

I have configured a VIP on the LTM that is internal.mycompany.com and created the following iRule

 

when HTTP_REQUEST { HTTP::redirect "https://mycompany.f5.com/?whr=tetrapak.com[HTTP::uri]" } This iRule is being attached to the VIP in the iRule section. At this point I am not getting redirected. I have looked up the iRule but can't seem to find the complete picture on how to set this up. Can someone help please?

 

  • It needs to be:

    when HTTP_REQUEST {
        HTTP::respond 301 "Location" "https://mycompany.f5.com[HTTP::uri]?whr=tetrapak.com"
    }
    

    HTTP::uri is caps sensitive.

8 Replies

  • Thanks for the help but I get the following error when trying to update the iRule

     

    01070151:3: Rule [/Common/RedirectTest] error: /Common/RedirectTest:2: error: [undefined procedure: HTTP::URI][HTTP::URI]

     

    • cjbarr1234's avatar
      cjbarr1234
      Icon for Nimbostratus rankNimbostratus
      I ran into this a while ago and that iRule works really well. I had some mega issues though with SSL sites. I dealt with a SaaS company that I wanted to do the same thing. Glad you had this work out!
  • It needs to be:

    when HTTP_REQUEST {
        HTTP::respond 301 "Location" "https://mycompany.f5.com[HTTP::uri]?whr=tetrapak.com"
    }
    

    HTTP::uri is caps sensitive.

    • Matt_A_184631's avatar
      Matt_A_184631
      Icon for Nimbostratus rankNimbostratus
      That did it..Thanks a lot for this it would have taken me forever to figure it out.
  • It needs to be:

    when HTTP_REQUEST {
        HTTP::respond 301 "Location" "https://mycompany.f5.com[HTTP::uri]?whr=tetrapak.com"
    }
    

    HTTP::uri is caps sensitive.

    • Matt_A_184631's avatar
      Matt_A_184631
      Icon for Nimbostratus rankNimbostratus
      That did it..Thanks a lot for this it would have taken me forever to figure it out.