Hi Steve,
Following your instructions, i've modified my irule like this ussing the code of nitass:
when HTTP_REQUEST {
set newhost "www.ejemplo.com"
if { not ([HTTP::host] equals $newhost ) } {
if { [HTTP::uri] equals "/" } {
HTTP::header replace Host $newhost
HTTP::uri "/[string map {www. ""} [HTTP::host]]"
if {$host_debug}{log local0. "[HTTP::host]: First Case: Replaced Host header with $newhost"/[string map {www. ""} [HTTP::host]]"."}
} else {
HTTP::header replace Host $newhost
if {$host_debug}{log local0. "[HTTP::host]: Second Case: Replaced Host header with $newhost"}
}
}
}
}
Then, my question is oriented to the old version of my irule.
When i tried to replace the irule with:
when HTTP_REQUEST {
set newhost "www.ejemplo.com"
Se usa solo en el caso dos
set hostname [getfield [HTTP::host] ":" 1]
set suri [getfield [HTTP::host] ":" 1]
set ouri [HTTP::uri]
if{ (not ([HTTP::host] equals $newhost)) and (not ([HTTP::uri] equals "/"))
}
{
HTTP::header replace Host $newhost
if {$host_debug}{log local0. "[HTTP::host]: First Case: Replaced Host header with $newhost$ouri."}
}
elseif { (not ([HTTP::host] equals $newhost))
}
{
HTTP::header replace Host $newhost/$suri
if {$host_debug}{log local0. "[HTTP::host]: Second case: Replaced Host header with $newhost/$suri."}
}
}
What am i doing wrong?, why am i getting "101 connection reset" when i tried HTTP::header replace Host $newhost/$suri in the second case.
Kind Regards.