Forum Discussion
iRule error after upgrade version (Operation not supported. Multiple redirect/respond invocations not allowed)
Hi Ciao,
this error would happen if a previous rule had already responded the request and you try to respond a second time to the very same request. The return command unfortenately doesn't stop the processing of following iRules...
You may either combine those rules into a single one and then
return
the script after each [HTTP::respond]
...
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] equals "/something.txt" } {
HTTP::respond 200 content "User-agent: * \nDisallow: /somretyhing.pe \nAllow: /"
return
}
if { [string tolower [HTTP::path]] equals "/somethingother.txt" } {
HTTP::respond 200 content "User-agent: * \nDisallow: /somretyhing.pe \nAllow: /"
return
}
}
... or you may inform the later iRules that the request is already responded...
when HTTP_REQUEST {
set already_responded 0
if { [string tolower [HTTP::path]] equals "/something.txt" } {
HTTP::respond 200 content "User-agent: * \nDisallow: /somretyhing.pe \nAllow: /"
set already_responded 1
return
}
}
when HTTP_REQUEST {
if { $already_responded } {
do nothing
} else {
if { [string tolower [HTTP::path]] equals "/somethingother.txt" } {
HTTP::respond 200 content "User-agent: * \nDisallow: /somretyhing.pe \nAllow: /"
return
}
}
}
Note: Keep in mind to trigger a
set already_responded 0
in the first iRule to initialize/reset the variable.
A third option would be to see if a response is already send to the client by trying to minipulate the REQUEST or RESPONSE headers and [catch] the error which would happen if a response is already send. But this could have a certain performance impact.
when HTTP_REQUEST {
if { [catch {HTTP::payload replace 0 0 {}}] } then {
do nothing
} else {
if { [string tolower [HTTP::path]] equals "/something.txt" } {
HTTP::respond 200 content "User-agent: * \nDisallow: /somretyhing.pe \nAllow: /"
return
}
}
}
when HTTP_REQUEST {
if { [catch {HTTP::payload replace 0 0 {}}] } then {
do nothing
} else {
if { [string tolower [HTTP::path]] equals "/somethingother.txt" } {
HTTP::respond 200 content "User-agent: * \nDisallow: /somretyhing.pe \nAllow: /"
return
}
}
}
Cheers, Kai
Recent Discussions
Related Content
* 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