hello , we are getting below error in logs , iR_XFF_RewriteOrInsert irule was working fine before we placed new irule Http error TCL error: iR_XFF_RewriteOrInsert - Operation not supported (line 4) invoked from within "HTTP::header insert X-Forwarded-For [substr [IP::client_addr] 0 “%”]
existing irule when HTTP_REQUEST { if {[HTTP::header exists X-Forwarded-For]}{ HTTP::header replace X-Forwarded-For [substr [IP::client_addr] 0 “%”] } else { HTTP::header insert X-Forwarded-For [substr [IP::client_addr] 0 “%”] } } new irule added last week to function with existing irule when HTTP_REQUEST { if {([class match [IP::remote_addr] equals whitelist]) } { pool Pool_1 } else { HTTP::respond 503 content [b64decode [class element -name 0 DG_MAINTENANCE_HTML]] “Content-Type” “text/html” } }
First, the error should only be manifesting when the client source doesn’t match your whitelist data group, where you subsequently send a 503. In the order that you have your iRules applied to the VIP (assuming new one on top), you’re potentially sending a 503 response (an egress mechanism) BEFORE attempting to add a header to the ingress stream. You should be able to solve this two ways:
Re-order the iRules in your VIP configuration, or
Apply priority tags to the HTTP_REQUEST events to force a specific order, like this:
when HTTP_REQUEST priority 50 {
if { [HTTP::header exists X-Forwarded-For] } {
HTTP::header replace X-Forwarded-For [substr [IP::client_addr] 0 "%"]
} else {
HTTP::header insert X-Forwarded-For [substr [IP::client_addr] 0 "%"]
}
}
when HTTP_REQUEST priority 100 {
if { ( [class match [IP::client_addr] equals whitelist] ) } {
pool Pool_1
} else {
HTTP::respond 503 content [b64decode [class element -name 0 DG_MAINTENANCE_HTML]] "Content-Type" "text/html"
}
}
thanks for reply Kevin I have reordered the irules but we are still recieving errors . Mon Jan 6 09:48:44 GMT 2014 err local/tmm3 tmm3[6222] 01220001 TCL error: iR_XFF_RewriteOrInsert - Operation not supported (line 4) invoked from within “HTTP::header insert X-Forwarded-For [substr [IP::client_addr] 0 “%”]”