Anthony
Sep 27, 2019Nimbostratus
Solved
TCL error on simple replace header iRule
I'm getting a TCL error from a very simple iRule and cannot understand what scenario would cause it to fail.
The iRule does a simple port removal from the host header.
when HTTP_REQUEST
{
if { [HTTP::host] contains ":" }
{
log local0. "[HTTP::host] becomes [substr [HTTP::host] 0 ":"]"
HTTP::header replace Host "[substr [HTTP::host] 0 ":"]"
}
}
Sep 27 12:20:19 LTM1 info tmm3[22524]: Rule /Common/remove_port <HTTP_REQUEST>: www.domain.com:443 becomes www.domain.com
Sep 27 12:20:19 LTM1 err tmm3[22524]: 01220001:3: TCL error: /Common/remove_port <HTTP_REQUEST> - Operation not supported (line 4) invoked fro
m within "HTTP::header replace Host "[substr [HTTP::host] 0 ":"]""
Any ideas on what scenario would cause this to happen? It works on most, just seems there is something particular that causes the error to be thrown.
Many thanks
Anthony
Try this.
when HTTP_REQUEST { if { [HTTP::host] contains ":" } { log local0. "[HTTP::host] becomes [getfield [HTTP::host] {:} 1]" HTTP::header replace Host [getfield [HTTP::host] {:} 1] } }
KR,
Dario.