Forum Discussion
DeVon_Jarvis
Mar 09, 2009Nimbostratus
HTTP::is_redirect error?
I have built this iRule to simulate the "Redirect_Rewrite modify" option.
when HTTP_REQUEST {
Save the host
set host [string tolower [HTTP::host]]
}
...
DeVon_Jarvis
Mar 09, 2009Nimbostratus
BTW: I am on 9.4.6
I changed the code to test the HTTP::status for 301, 302, etc, and the error has changed.
when HTTP_REQUEST {
Save the host
set host [string tolower [HTTP::host]]
}
when HTTP_RESPONSE {
switch [HTTP::status] {
"301" -
"302" -
"303" -
"305" -
"307" {
set redirect 1
}
default {
set redirect 0
}
}
if {$redirect == 1} {
set location [string tolower [HTTP::header "Location"]]
if { ($location starts_with "http://") and ($location contains $host)} {
HTTP::header replace Location [string map -nocase { "http://" "https://" } [HTTP::header value Location]]
}
}
}
Mar 9 14:38:33 tmm tmm[1729]: 01220001:3: TCL error: redirect_to_https_matching - Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::status"
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