For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Shlairshe_84486's avatar
Shlairshe_84486
Icon for Nimbostratus rankNimbostratus
Apr 22, 2014

OLD URL TO NEW URL REDIRECT USING DIFFERENT PORT.

Hi, I am a freshman iruler and I am trying to redirect from one url to a separate url and in doing this going from http to https but the port used will NOT be 443, but in this case it will be something different such as 9999. So to put it in a practical perspective. I have this site www.oldsite.com, when users type this site I want them to get redirected to www.newsite.com, and in getting redirect it should be from http to https using port 9999 instead of the usual 443.

 

Below is what I have, but I think I am missing something, because I am getting an error.

 

HTTP::header replace Host "[HTTP::host]:9999" if { [string tolower [HTTP::host]] equals "www.oldsite.com" } { HTTP::redirect "https://www.newsite.com" } }

 

NOTE: I know this should be possible. I think I am just missing something I am not recognizing.

 

3 Replies

  • Try this one:

    when HTTP_REQUEST {
           HTTP::redirect https://[getfield [HTTP::host] ":" 1]:9999[HTTP::uri]
        }
    
  • quite short , will try it, and let you know, just a quick question, the 1]:9999, is it missing another brace.

     

    Rgds,

     

    Steven.

     

  • The syntax should be correct. You'd apply it to your virtual server that's listening on HTTP (presumably port 80) and it'll redirect to 9999 on HTTPS.