Forum Discussion

Charlie_2_10323's avatar
Charlie_2_10323
Icon for Nimbostratus rankNimbostratus
May 14, 2009

Rewriting Host, Uri and respond

 

Hi

 

 

We try to write an iRule to rewrite hostname, and uri bevor send it to Server and rewrite back for respond to client.

 

There are multiple uri,s to rewrite but one hostname.

 

So that it does not become simple, the blo.server.com is not behind big-ip it is a Server im Internet, which we will play middlemen.

 

 

when HTTP_REQUEST {

 

Check host/uri (set to lowercase)

 

switch "[string tolower [HTTP::host][HTTP::uri]]" {

 

"www.client.com/rk/" {

 

HTTP::header replace Host "blo.server.com"

 

HTTP::uri "/rk/index.php"

 

set target_pool "blo.server"

 

pool blo.server

 

}

 

"www.clinet.ch/rk/xml.php" {

 

Rewrite host/URI

 

HTTP::header replace Host "blo.server.com"

 

HTTP::uri "/rk/xmlrpc.php"

 

set target_pool "blo.server"

 

pool blo.server

 

}

 

}

 

}

 

 

when HTTP_RESPONSE {

 

 

if { $target_pool == "blo.server" } {

 

 

set location [HTTP::header value Location]

 

log local0.info "Server-RESPONS"

 

rewrite the location header

 

HTTP::header replace Location [string map {"blo.server.com" "www.client.com"} [HTTP::header Location]]

 

}

 

}

 

 

Does someone have idea?

 

 

Regards

 

Charlie

 

1 Reply

  • Hi Charlie,

     

    Please re-write your question again. I and probably others in this forum cannot understand what you want us to exactly help you with.

     

     

    thanks

     

    CB