Forum Discussion
jato_40959
Nimbostratus
Jun 02, 2010Redirect 301
I have implemented this irule in my system:
when HTTP_REQUEST {
HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
The irule isn't working, i found this message in logs:
Jun 1 09:49:11 local/tmm1 err tmm1[26096]: 01220001:3: TCL error: HTTP_To_HTTPS_Redirect_301 - Operation not supported. Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
Jun 1 10:24:44 local/tmm2 err tmm2[26097]: 01220001:3: TCL error: HTTP_To_HTTPS_Redirect_301 - Operation not supported. Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
Can anyone help me?
Thanx in advance and regards
18 Replies
- hoolio
Cirrostratus
[HTTP::host] will return whatever the client requested. So if the request was made to www.mydomain1.es/index.html, the redirect will be sent to https://www.mydomain1.es/index.html. If the request was made to www.mydomain2.es/index.html, the redirect will be sent to https://www.mydomain2.es/index.html.
Aaron - jato_40959
Nimbostratus
Posted By hoolio on 06/14/2010 05:58 AM
[HTTP::host] will return whatever the client requested. So if the request was made to www.mydomain1.es/index.html, the redirect will be sent to https://www.mydomain1.es/index.html. If the request was made to www.mydomain2.es/index.html, the redirect will be sent to https://www.mydomain2.es/index.html.
Aaron
but, if you see first post, it isn't working.
Jun 1 09:49:11 local/tmm1 err tmm1[26096]: 01220001:3: TCL error: HTTP_To_HTTPS_Redirect_301 - Operation not supported. Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
Jun 1 10:24:44 local/tmm2 err tmm2[26097]: 01220001:3: TCL error: HTTP_To_HTTPS_Redirect_301 - Operation not supported. Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
Thanx for your replies - hoolio
Cirrostratus
Are you sure there isn't another iRule enabled on the VS? Or have you added something else to that iRule? The error you've posted should only occur when one or more iRules attempts to send a HTTP response or redirect multiple times for the same HTTP request.
Aaron - jato_40959
Nimbostratus
I have two irules:
1. for WAP traffic:
when HTTP_REQUEST {
if { [HTTP::host] equals "www.mydomain.es" } {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*midp*" -
"*cldc*" {
HTTP::redirect "https://wap.mydomain.es" }
}
}
}
2. for 301:
when HTTP_REQUEST {
HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
Do you think this is the problem? - The_Bhattman
Nimbostratus
Hi Jato,
Can you integrate the 2 rules together in the say the SWITCH statement. Perhaps a DEFAULT ie:when HTTP_REQUEST { if {[HTTP::host] equals "www.my domain.es" } { switch -glob [string to lower [HTTP::header User-Agent]] { "mid*" - "cidc*" { HTTP::redirect "https://wap.my domain.es" } default " { HTTP::respond 301 Location https://[get field [HTTP::host] ":" 1][HTTP::uri] } } } }
I hope this helps
Bhattman - jato_40959
Nimbostratus
Hi Bhattman!
but... if I integrate both iRules in only one, the problem will be the same, no?
After all is the same, but in only one irule.
Thank you so much - hoolio
Cirrostratus
The error occurs if you try to send more than one response using HTTP::redirect or HTTP::respond for the same request. So this would cause the error:when HTTP_REQUEST { HTTP::respond 200 content "first response" HTTP::redirect "http://second.example.com/" }
Bhattman's example can only ever send one response per request, so it should work fine.
Aaron - jato_40959
Nimbostratus
Ok,
The next weekend i'll have a window in my customer to do that.
I'll say you the result of it.
Thank you so much to both.
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
