Forum Discussion
hooleylist
Jul 01, 2010Cirrostratus
Hi Craig,
I think that's a good start logically. Here are a couple related approaches:
when HTTP_REQUEST {
Check if domain is "www.domain.com"
if {[string tolower [HTTP::host]] eq "www.domain.com"}{
Check if URI isn't /specialdirectory
switch [HTTP::uri] {
"/specialdirectory" {
Exit this event from this iRule
return
}
default {
Redirect everything else for www.domain.com to HTTPS
HTTP::redirect "https://[HTTP::host][HTTP::uri]
}
}
}
No other action is taken for hosts which aren't www.domain.com
}
Or if you want to redirect all requests to any domain except requests for www.domain.com/specialdirectory, you could use an iRule like this:
when HTTP_REQUEST {
Check if domain is "www.domain.com"
if {[string tolower [HTTP::host]] eq "www.domain.com"}{
Check if URI isn't /specialdirectory
switch [HTTP::uri] {
"/specialdirectory" {
Exit this event from this iRule
return
}
}
}
Redirect everything else to HTTPS
HTTP::redirect "https://[HTTP::host][HTTP::uri]
}
Aaron