Forum Discussion

JackYates_39764's avatar
JackYates_39764
Icon for Nimbostratus rankNimbostratus
May 08, 2011

https redirection Irule on https virtual server

I'm trying to work out a way to re-direct an https request to another https URL.

 

 

Link comes in as https;//oursite.com

 

 

I have an IRule on the HTTP Virtual server that converts http://oursite.com over to https://oursite.oursite.com/abc and that works fine.

 

But if I do https://oursite.com it does not get converted. I have tried applying the same IRule to the HTTPS Virtual server but that is not working.

 

 

The IRule looks like this.

 

 

when HTTP_REQUEST {

 

 

set host [string tolower [HTTP::host]]

 

 

if { ( ($host starts_with "oursite.com") or ($host starts_with "www.oursite.com")) } {

 

 

HTTP::redirect "https://oursite.oursite.com/abc"

 

 

}

 

 

}

 

 

 

Thanks! Jack.

 

3 Replies

  • Ok, I think I found the issue we are having. Pretty silly thing, which is probably why no one responded to my topic. :)

     

     

    The traffic comes in to the virtual server for https first and the cert does not match the url so you get the cert error message first before any conversion is done. If you click through the cert error to accept the "risk" then the conversion happens and you get sent to the correct page.
  • Glad to hear that you fixed your problem. No real way around the problem you encountered without splitting this (www and non-www) onto different Virtual Servers.

     

     

    You could save yourself a step by removing the string tolower [HTTP::host]. The Host portion of a URL is case-insensitive on all platforms. The URI is case sensitive on on most.
  • RFC2616 states the host header value must be considered without case sensitivity. All modern browsers set the Host to lowercase before sending the request. However, custom clients might not. Therefore, we generally set the host to lowercase before comparing it to ensure the iRule is following RFC2616.

     

     

    Aaron