Sep 05, 2018
HTTP::header replace error
Hello,
I currently have an irule applied to a Virtual Server and recently noticed some error messages in the logs. I am not sure when it actually started but it has been consistent for the past 30 days. We upgraded our LTM from version 11.5.2 to 12.1.3.4 a few months ago so, I am not sure if the errors started after the upgrade or not.
Here is the error message:
- Operation not supported (line 1) invoked from within "HTTP::header replace Host $rewrite_host"
Here is the current irule:
when RULE_INIT {
Set to 1 to enable logging, 0 to disable
set static::debug 0
Set to Site URL
set static::vs_host_abc_prod "www.abc.com"
}
when CLIENT_ACCEPTED {
Store the default pool name
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
set uri_lower [string tolower [HTTP::uri]]
if { [class match $uri_lower starts_with folder_check] } {
if { [string first "/" [string range $uri_lower [expr {[string first "/" [string range $uri_lower 2 end]] + 3}] end]] > 0 } {
set str_end [expr {[string first "/" [string range $uri_lower [expr {[string first "/" [string range $uri_lower 2 end]] + 3}] end]] + 6}]
} else {
set str_end "end"
}
} else {
if { [string first "/" [string range $uri_lower 2 end]] > 0 } {
set str_end [expr {[string first "/" [string range $uri_lower 2 end]] + 1}]
} else {
set str_end "end"
}
}
set folder [string range $uri_lower 1 $str_end]
if { $static::debug > 0 } { log local0. "URI: [HTTP::uri] - Found folder $folder" }
if { [class match -- $folder equals rewrite_folders] } {
set url_rewrite 1
set rewrite_host [class match -value $folder equals rewrite_folders ]
HTTP::header replace Host $rewrite_host
if { $static::debug > 0 } { log local0. "client [IP::client_addr]:[TCP::client_port] server [IP::remote_addr]:[TCP::release] host [HTTP::host]" }
if { $static::debug > 0 } { log local0. "URI: [HTTP::uri]" }
set dest [lindex [RESOLV::lookup @208.67.222.222 -a [HTTP::host]] 0]
if { $dest ne "https://$rewrite_host" } {
SSL::enable clientside
if { $static::debug > 0 } { log local0. "Destination IP is $dest" }
node $dest
}
} else {
set url_rewrite 0
if { $static::debug > 0 } { log local0. "-->[HTTP::uri] $default_pool" }
pool $default_pool
}
}
when HTTP_RESPONSE {
if { $url_rewrite > 0 } {
if {[HTTP::header exists Location]} {
set protocol [string range [HTTP::header Location] 0 [string first ":" [HTTP::header Location]]]
set locationrewrite "$protocol//$static::vs_host_abc_prod[string range [HTTP::header Location] [expr {[string first "/" [string range [HTTP::header Location] 9 end]] + 9}] end]"
if { $static::debug > 0 } { log local0. "HTTP Location Before: [HTTP::header Location]" }
if { $static::debug > 0 } { log local0. "Updated Version: $locationrewrite" }
HTTP::header replace Location $locationrewrite
}
STREAM::expression "@$rewrite_host@$static::vs_host_abc_prod@"
STREAM::enable
}
}
Any suggestions would be greatly appreciated.
Thanks.