Forum Discussion

isavic's avatar
isavic
Icon for Nimbostratus rankNimbostratus
Nov 28, 2019

HTTPS to HTTPS redirect in F5

Hi,

Please help me to create an irule or policy to redirect https://loadandgo.test.ca to https://www.test.ca/arrow/Redirect?id=45156_Rexall_LoadandGo_E. I'm not sure what service port should I use since I already tried different options and none of them did work. Whenever I try to load https://loadandgo.test.ca none of the rules worked nor policy I created. it only works when I use service port 80 and load http not https(which I need) in this case. Irules used so far:

when HTTP_REQUEST {

 if { [string tolower [HTTP::host]] eq "www.example.com" and [HTTP::path] eq "/path1/abc" } {

   HTTP::respond 301 Location "http://www.new-example.com/abcd"

 }

}

 

when HTTP_REQUEST {

1.   if { [HTTP::host] eq "website1.com" } {

2.     HTTP::redirect https://websitesite2.com[HTTP::uri]

3.   }

 

 

1. when HTTP_REQUEST {

2. if { ([string tolower [HTTP::host]] equals "page1.com") && ([TCP::local_port] == 443)} {

3. HTTP::redirect "http://page2.com"

4. }

5. }

 

1. when HTTP_REQUEST {

2. if { ([string tolower [HTTP::host]] equals " page1.com") && ([TCP::local_port] == 443)} {

3. HTTP::redirect " http://page2.com"

4. }

}

4 Replies

  • Help us confirm few things, Is https://loadandgo.test.ca managed in your LTM.

    If yes, I believe you have an 80 Virtual & a 443 virtual. I could see 80 virtual is already redirecting it to 443 already.

     

    Help us understand the 443 virtual configuration. Are you simply putting an Irule to do the redirection to your another url (BTW, I see you have missed to mask your domain, mask it if you feel its confidential).

    Note 443 virtual is https. Its an encrypted tunnel. You can't do redirection stuffs unless you see make it a plain text. So offload the SSL traffic first with a clientssl profile. And then do your Irule stuff.

     

    Let us know how it goes.

  • isavic's avatar
    isavic
    Icon for Nimbostratus rankNimbostratus

    I did with the right clientSSL and Irule applied to it. The Irule i used worked for me:

    1. when HTTP_REQUEST {

    2. if { ([string tolower [HTTP::host]] equals " page1.com") && ([TCP::local_port] == 443)} {

    3. HTTP::redirect " http://page2.com"

    4. }

    }

    Thanks again for your help. I masked the domain name BTW.

    • Good to hear that the issue is solved. You can mark your own as solved then.