Forum Discussion
TCL error <http_request> - Operation not supported (line 1) invoked from within "HTTP::header remove Cache-Control"</http_request>
I'm Having an issue with my Irule
the rule perpus is to diabale the user option to ask "no Cache" (ctrl +F5)
when HTTP_REQUEST {
if { [HTTP::header exists "Cache-Control"] } {
HTTP::header remove Cache-Control
}
if { [HTTP::header exists "Pragma"] } {
HTTP::header remove Pragma
}
}
- Jad_Tabbara__J1Cirrostratus
Hello Lior,
Could you share the output of
tmsh list ltm virtual your-vs-name
Thanks
Hi Lior,
the error you see is most likely caused because a previous iRule/LTM Policy has already responded the ongoing HTTP request. After the HTTP request is responded an attempt to modify the HTTP headers will create that kind of TCL exemption.
You can workaround be either:
1.) Change the order of the iRule so that the manipulation takes place before the redirection
rules { Set_Response_Private Request_gzip Rem_DeviceID_From_Articles Igonre_CTRLF5 Mobile_Redirect }
2.) Combine the individual iRules into a single one and use the
command after eachreturn
HTTP::respond
command, to abort further iRule processingHTTP::redirect
when HTTP_REQUEST { if { $something eq true } then { HTTP::redirect "http://somewhere/somefile.txt" Stop the execution of the current iRule... return } if { [HTTP::header exists "Cache-Control"] } { HTTP::header remove Cache-Control } if { [HTTP::header exists "Pragma"] } { HTTP::header remove Pragma } }
3.) Use the
command to explicitly check if the HTTP request was already responded.[catch]
when HTTP_REQUEST { if { [catch {HTTP::payload replace 0 0 {}}] } then { The request was already responded... return } if { [HTTP::header exists "Cache-Control"] } { HTTP::header remove Cache-Control } if { [HTTP::header exists "Pragma"] } { HTTP::header remove Pragma } }
4.) Use the
command to overwrite the exemptions of the commands which may fail under certain conditions.[catch]
Example 1:
when HTTP_REQUEST { if { [HTTP::header exists "Cache-Control"] } { catch { HTTP::header remove Cache-Control } } if { [HTTP::header exists "Pragma"] } { catch { HTTP::header remove Pragma } } }
Example 2:
when HTTP_REQUEST { catch { if { [HTTP::header exists "Cache-Control"] } { HTTP::header remove Cache-Control } if { [HTTP::header exists "Pragma"] } { HTTP::header remove Pragma } } }
5.) Implement some signaling between your iRule to inform subsequent iRules that a HTTP request has been already responded.
iRule 1:
when HTTP_REQUEST { if { $something eq true } then { HTTP::redirect "http://somewhere/somefile.txt" Imform subsequent iRule that the request has been responded. set is_already_responded true } }
iRule 2:
when HTTP_REQUEST { if { not $is_already_responded } then { if { [HTTP::header exists "Cache-Control"] } { HTTP::header remove Cache-Control } if { [HTTP::header exists "Pragma"] } { HTTP::header remove Pragma } } }
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