Redirect specific urls on VS

Hi Guys,

I have 1 VS listening on port 80. This VS serves a website and also redirects requests. What kind of Irule would help me to exlude 1.domain.com from redirection. And redirect every other domain requests from 80 to 443?

Thanks in advance.

I had the following irule in mind:

when HTTP_REQUEST {

 Check if domain is "www.domain.com"
if {[string tolower [HTTP::host]] eq "1.domain.com"}{
      Exit this event from this iRule
       return
     }
   }
  }
   Redirect everything else to HTTPS
  HTTP::redirect "https://[HTTP::host][HTTP::uri]

You could do something similar to this: (Note I have not tested this)

when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::host]] {
        "domainame.noredirect.com" - 
        "domainname2.noredirect.com" { pool poolname_pool }
        default {
          HTTP::redirect "https://[HTTP::host][HTTP::uri]"
        }
    }
}

You can make it simpler if you reverse the logic and use an ‘if not(!)’

when HTTP_REQUEST {
    if {!([string tolower [HTTP::host]] eq "1.domain.com")} {
        HTTP::redirect "https://[HTTP::host][HTTP::uri]
    }
}