Forum Discussion

MR_Freddy's avatar
MR_Freddy
Icon for Nimbostratus rankNimbostratus
Nov 17, 2017

https redirection on https VIP

I need to redirect http request on Vip listens on https port as the following

 

1) for certain url ,,,, redirect normally it to http not https 2) else redirect all http requests to https (Here we can use system https redirect)

 

can you guide me to create this irule ?

 

1 Reply

  • For HTTP redirect you need a virtual server listening on 80 or any custom HTTP port with redirect iRules maybe something like :

    when HTTP_REQUEST {  
       if { [string tolower [HTTP::host]] eq "sample.com" } {  
         HTTP::respond 301 Location "http://www.redirectsample.com[HTTP::uri]"
          }
       else {
           HTTP::respond 301 Location "https://[getfield [HTTP::host] : 1][HTTP::uri]"
            }   
     }
    

    you can use [HTTP::uri] if you need to redirect based on uri.