Forum Discussion
charlestips_149
Nimbostratus
Jun 30, 2010http to https redirect except for specific URL
We currently have a wildcard cert and virtual server setup so that anyone trying to go to http://www.domain.com/directory gets redirected to https://www.domain.com/directory simple enough
wh...
hoolio
Cirrostratus
Jul 06, 2010In theory, the Host header could be set by the client in upper, lower or mixed case and the server must interpret it with out case sensitivity. So to follow RFC2616, you should actually set the Host header value to lower case before checking it. In practice, all major browsers set the Host header value to lower case. I think most applications would be case sensitive for the query string. For IIS, the path isn't case sensitive.
Charles, you might want to change "contains" to starts with:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]"
Check if domain is "www.domain.com"
if {[string tolower [HTTP::host]] eq "ww2.domain.com"}{
Check if URI doesn't start with /directory
if {[string tolower [HTTP::path]] starts_with "/directory"} {
log local0. "[IP::client_addr]:[TCP::client_port]: Allowing request through"
Exit this event from this iRule
return
}
}
Redirect everything else to HTTPS
HTTP::redirect "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting request"
}
If there are still issues with this iRule, you can check the log output from /var/log/ltm to see what the iRule is doing.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects