Forum Discussion

Stephen_Loeckle's avatar
Stephen_Loeckle
Icon for Nimbostratus rankNimbostratus
Nov 26, 2012

Auto SSL Selection

Hi Everyone,

 

I need some help designing an irule, or multiple irules. We have a customer who has their main website behind their LTM. There are two virtual servers setup for this website. One for http and the other for https. We're doing SSL offload for just a couple forms. While on port 80, if a user goes to two pages on the website, they are successfully redirected to port 443 with the following irule:

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri]] {

 

"/giving*" {

 

HTTP::redirect "https://[HTTP::host]/giving"

 

}

 

"/formsdisplay.aspx?ekfrm=12884903667" {

 

HTTP::redirect "https://[HTTP::host]/formsdisplay.aspx?ekfrm=12884903667"

 

}

 

}

 

}

 

 

Works great. However, the customer wants users to be forced back to port 80 when they are done with these links because there are other portions of the website that are jacked up when SSL is forced because of external links and whatnot. We've given them the ability to rewrite these links with stream profiles and irules but they just don't want this. They insist on having the user go back to a non-ssl virtual server. How can I accomplish the reverse of the above on the SSL virtual server or can I rebuild this whole scenario in one virtual server with switching back and forth between port 80 and 443? Is the latter even possible?

 

 

This LTM is running 10.2.4.

 

 

Thanks,

 

 

Stephen

 

4 Replies

  • It's not elegant (and you'd want to test) but you could use this on the port 443 Virtual Server;

    
    when HTTP_REQUEST {
     switch -glob [string tolower [HTTP::uri]] {
      "/giving*" -
      "/formsdisplay.aspx?ekfrm=12884903667" {
       return }
      default {
       HTTP::redirect "http://[HTTP::host][HTTP::uri]" }
     }
    }
    
  • You could also improve the port 80 iRule too;

    
    when HTTP_REQUEST {
      switch -glob [string tolower [HTTP::uri]] {
        "/giving*" -
        "/formsdisplay.aspx?ekfrm=12884903667" {
          HTTP::redirect "https://[HTTP::host][HTTP::uri]"
        }
      }
    }