Forum Discussion

avaj_44503's avatar
avaj_44503
Icon for Nimbostratus rankNimbostratus
Oct 29, 2012

101 connection reset

 

Hi all.

 

Firstly, i have to thank to all contributors in this forum, because they've saved my life a lot of times.

 

Today i have a problem with one irule.

 

I am writing an irule that concern this concepts:

 

 

First. If the destiny does not contain an explicit domain and uri is empty, you have to redirect the request to some place, whit the source host as uri,

 

Second: If it has an uri, i have to replace the host with an especific host leave the original uri without modification.

 

As i'm spanish and i'm not sure if i'm explained me correctly there it go an example.

 

1.- I the domain it is not www.ejemplo.com and the uri have not content.

 

Example:

 

http://www.noejemplo.com/ --> http://www.ejemplo.com/noejemplo.com

 

2.- If the request content and uri:

 

Example:

 

http://www.noejemplo.com/xyz --> http://www.ejemplo.com/xyz

 

 

In my irule, the second part run perfectly but the first option give me an error "101 error connection reset".

 

As you'll see below i've put the response in a log to trace it.

 

I do not know if you had found some error like this.

 

 

This is my Irule:

 

when HTTP_REQUEST {

 

set host_debug 1

 

set newhost "www.ejemplo.com"

 

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."}

 

}

 

}

 

12 Replies