Forum Discussion
Charlie_2_10323
Nimbostratus
May 15, 2009HTTP Respond Data replacing ?
Hi
I will rewrite response hostname.
HTTP_Response function well, but HTTP_Respond_Data not.
We have on Request and Respond site HTTPS access
Client is ter...
Charlie_2_10323
Nimbostratus
May 18, 2009Hello, chbhatt & tarsier
I'm trying to find a way with an iRule (or any functionality really) to take a url like
https://blo.client.com/rk
https://blo.client.com/rk-admin/
and convert it to
https://blo.server.com/rk/index.htm
https://blo.server.com/rk/login.htm
as it goes through the bigip (running v9).
The catch is we cannot redirect the browser client to the blo.server.com/rk/index.htm site, the end user must always see blo.client.com.
To make it even more complicated, sometimes the server will send back a payload with a URL inside it for the user that we need to change from blo.server.com to blo.client.com .
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New request to [HTTP::host][HTTP::uri]"
switch "[string tolower [HTTP::host][HTTP::uri]]" {
"blo.client.com.ch/rk-admin/" {
HTTP::header replace "Host" "blo.server.com"
HTTP::uri "/rk/login.htm"
set target_pool "blo.server"
pool blo.server
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::host] [HTTP::uri] Rewrite host/uri (1)"
}
"blo.client.com/rk/" {
HTTP::header replace "Host" "blo.server.com"
HTTP::uri "/rk/index.htm"
set target_pool "blo.server"
pool blo.server
log local0. "[IP::client_addr]:[TCP::client_port]: Rewrite host/uri (2)"
}
}
}
when HTTP_RESPONSE {
HTTP::collect [HTTP::header Content-Length]
if { $target_pool == "blo.server" } {
set location [HTTP::header value Location]
log local0.info "Server-RESPONS"
HTTP::header replace Location [string map -nocase {"blo.client.com" "blo.serve.com"} [HTTP::header Location]]
log "BEFORE Replacing payload with new data."
}
}
when HTTP_RESPONSE_DATA {
set clen [string length [HTTP::payload]]
regsub -all "blo.client.com" [HTTP::payload] "blo.server.com" newdata
log "Replacing payload with new data."
HTTP::payload replace 0 $clen $newdata
HTTP::release
}
if is the backend server http (cleartext) this irull is running well, but when I try to change httpS- httpS respond HTTP_response_data it does not function.
Is there a way to do this?
Thanks for any help.
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