Forum Discussion
DaZZa
Nimbostratus
Jun 26, 2017HTTPS redirection with exceptions
Hi.
I have a web site which is used to by developers to build out corporate product. Because it's used for QA purposes, I want it to be as realistic as possible - but I am putting all the associ...
CharlesCS
Cirrus
Jun 27, 2017Presumably you don't care about the query string (if present), so you can simply focus on the path. If there are relatively few exception URIs that aren't being forwarded to HTTPS, you might code something like this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/foo/" -
"/bar*" -
"/some/particularly/long/example/" { return }
default {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
}
}If there are a large number of URIs, you might consider creating a data group and using class match instead of the switch command.
when HTTP_REQUEST {
if { [class match [HTTP::path] starts_with exception_URI_list] } {
return
}
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}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
