Forum Discussion
eduardo_26187
Nimbostratus
Mar 17, 2010iRule multiple redirect/respond invocations not allowed
Hi all,
There is a rule which is sending these messages to the logs, although the rule it's redirecting correctly. Nevertheless I have reports that some people visit the web page with "http" but it doesn't redirect to "https".
How could be possible that sometimes redirects and in few cases it doesn't?
This is my log:
Mar 17 08:59:02 tmm1 tmm1[12154]: 01220001:3: TCL error: rule_redirect_http2https - Operation not supported. Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::redirect "https://[HTTP::host]/Login.jsp"
Mar 17 09:03:59 tmm1 tmm1[12154]: 01220001:3: TCL error: rule_redirect_http2https - Operation not supported. Multiple redirect/respond invocations not allowed (line 9) invoked from within "HTTP::redirect "https://[HTTP::host]/Login.jsp"
This is the rule
when HTTP_REQUEST {
Check if the URI is /
if {[HTTP::path] eq "/"}{
HTTP::redirect "https://[getfield [HTTP::host] : 1]/Login.jsp"
}
if {
[TCP::local_port] == 80
} {
HTTP::redirect "https://[getfield [HTTP::host] : 1]/Login.jsp"
}
}
Thanks in advanced.
5 Replies
- hoolio
Cirrostratus
So if a client makes a request over port 80 for / both paths through the iRule will try to send a redirect.
Is this iRule used on an HTTP VIP (like 1.2.3.4:80) or many ports? If a single port, can you clarify why you're checking the destination port check?
Aaron - eduardo_26187
Nimbostratus
Hello Mr. Aaron, the HTTP VIP is like 1.2.3.4:443
I check the origin port 80 in case that someone changes https to http, so it forces to redirect to Login.jsp through https and it works fine.
As you said there is a double check when someone requests port 80 and /, I think I'd have to add "return 0" at the end of each rule. But I still have the question, why is not always redirecting? maybe 5% of the requests are rejected from outside of our network, but manually forcing "https" it works for the users. It always redirects from the lan.
Thanks. - hoolio
Cirrostratus
If someone makes a request to http://vip:443 they could make an unencrypted HTTP request to an HTTPS VIP. But the port would always be 443.
If you want to gracefully handle HTTP requests to an HTTPS VIP, you can enable non-SSL connections on the client SSL profile and then use an iRule like this:http://devcentral.f5.com/wiki/default.aspx/iRules/Redirect_non_ssl_requests_on_ssl_vs_rule.html when HTTP_REQUEST { Check if the client used an SSL cipher if {not ([catch {SSL::cipher version} result]) && $result ne "none"}{ Client did use a cipher log local0. "\$result: $result. Allowing encrypted request." if {[HTTP::path] eq "/"}{ HTTP::redirect "https://[getfield [HTTP::host] : 1]/Login.jsp" } } else { Client did not use a cipher log local0. "\$result: $result. Redirecting unencrypted request." HTTP::redirect "https://[getfield [HTTP::host] : 1]/Login.jsp" } }
Aaron - eduardo_26187
Nimbostratus
Thanks. This solutions is better. - Albert_Aguinaga
Nimbostratus
Hi - I'm getting the following error:
Sep 9 07:09:42 local/tmm err tmm[5253]: 01220001:3: TCL error: ir_final_maintpage - Operation not supported. Multiple redirect/respond invocations not allowed (line 12) invoked from within "HTTP::respond 503 content "Hanley Wood, LLC - Maintenance Page
Here is my iRule:
when HTTP_REQUEST {
sets the timer to return client to host URL
set stime 10
Use the Host header value for the responses if it's set. If not, use the VIP address.
if {[string length [HTTP::host]]}{
set host [HTTP::host]
} else {
set host [IP::local_addr]
}
Check if the URI is /maintenance
switch [HTTP::uri] {
"/maintenance" {
Send an HTTP 503 response with a Javascript meta-refresh pointing to the host using a refresh time
HTTP::respond 503 content \
"Hanley Wood, LLC - Maintenance Page\
This webpage is currently unavailable; please check back again shortly.
" "Content-Type" "text/html"
return
}
}
If the pool_testLB is down, redirect to the maintenance page
if { [active_members [LB::server pool]] < 1 } {
HTTP::redirect "http://$host/maintenance"
return
}
}
So, I'm thinking about using the TCP::close option but am not sure where to put this. Any thoughts as to why these TCL errors keep showing up?
Thanks in advance.
-Albert.
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