Forum Discussion
Logs triggering due to irule
Hi All,
I am getting continues logs for as mentioned below. The irule for which i am getting alerts is below. Looking for more information from experts in devcentral
TCL error: /Common/True-Client-IP_or_X-Forwarded-For - Operation not supported (line 14) invoked from within "HTTP::header insert X-Forwarded-For [IP::client_addr]"
Code
when HTTP_REQUEST {
if {[HTTP::header exists True-Client-IP]}{
if {[HTTP::header exists X-Forwarded-For]}{
HTTP::header remove X-Forwarded-For
HTTP::header insert X-Forwarded-For [HTTP::header True-Client-IP]
} else {
HTTP::header insert X-Forwarded-For [HTTP::header True-Client-IP]
}
}
else {
if {[HTTP::header exists X-Forwarded-For]}{
HTTP::header remove X-Forwarded-For
HTTP::header insert X-Forwarded-For [IP::client_addr]
} else {
HTTP::header insert X-Forwarded-For [IP::client_addr]
}
}}
2 Replies
- Lee_Sutcliffe
Nacreous
You're missing a closing brace "}" I've added it to the last line: I've also moved the 'else' in the first 'if' to be between the close and open braces as TCL sometimes complains about it
when HTTP_REQUEST { if {[HTTP::header exists True-Client-IP]}{ if {[HTTP::header exists X-Forwarded-For]}{ HTTP::header remove X-Forwarded-For HTTP::header insert X-Forwarded-For [HTTP::header True-Client-IP] } else { HTTP::header insert X-Forwarded-For [HTTP::header True-Client-IP] } } else { if {[HTTP::header exists X-Forwarded-For]}{ HTTP::header remove X-Forwarded-For HTTP::header insert X-Forwarded-For [IP::client_addr] } else { HTTP::header insert X-Forwarded-For [IP::client_addr] } } } - Stanislas_Piro2
Cumulonimbus
Hi,
this error is not an irule format error but may be the consequence of a redirect on another irule evaluated before.
if you have 2 irules assigned to the same VS:
- irule 1 : execute a redirect
- irule 2 : change HTTP request headers or execute another redirect
then, the second irule will raise the same error you posted because the first irule redirect invalidate any other HTTP changes operations.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
