Forum Discussion
Jason_Andres_40
Nimbostratus
Sep 27, 2007switch http to https if header contains "SSL" =1
I'm trying to create an iRule to switch HTTP to HTTPS if the HEADER contains SSL=1.
In our coldfusion code we insert in the the Header the name SSL with a value of 1 when someone clicks thro...
Andy_Herrman_22
Nimbostratus
Sep 27, 2007Looks like you have one missing } in the first irule and a misplaced } in the second one.
In the first one you have 5 "{" characters and only 4 "}" characters. You're not closing the "when" statement.
In the second one you have a second "}" immediately after the second if's test. This should really be at the end.
Here's what I came up with to fix it (there might still be problems, but this is what I found):
when HTTP_RESPONSE {
if { [HTTP::header "SSL"] == 1 } {
if { [TCP::local_port] == 80 } {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
}
}
when HTTP_RESPONSE {
if { [HTTP::header "SSL"] <> 1 } {
if { [TCP::local_port] == 443 } {
HTTPS::redirect http://[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