Forum Discussion
Charlie_2_10323
Nimbostratus
May 14, 2009Rewriting 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
- The_Bhattman
Nimbostratus
Hi Charlie,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects