Forum Discussion
sstafford
Nimbostratus
Jul 30, 2008string based https redirect
Hi all--yes I'm new.
Have a customer that needs a specific page or two forced to https when requested by a client. After poking around some, I came up with
when HTTP_REQ...
Jul 30, 2008
Here is another way to go about it with a wildcard switch and it will perform a bit better than all of the comparisons above:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*alumni/giving/gift/" -
"*alumni/giving/pledge/" -
"*alumni/directory/search.aspx" -
"*alumni/directory/update.aspx" {
HTTP::respond 301 Location "https://[getfield [HTTP::host] : 1][HTTP::uri]"
}
}
}
I also threw in a "string tolower" in the comparison string so that you would catch all case options (since you seem to be using IIS and IIS is case-insensitive).
-Joe
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