Forum Discussion
bjornberglund_1
Nimbostratus
Jan 29, 2014Redirecting and masquerading the result for the client.
Hi, I'm trying to redirect from one url to another and not have the client know about it. It does not work with the stuff I found soo far. HTTP::header replace Host "xxx.yyy.zzz" The client sees this...
Kevin_Stewart
Employee
Jan 29, 2014Here's a very basic iRule that will catch headers and payload data. Apply an empty STREAM profile to the virtual server to enable STREAM processing in the iRule. If you don't need to catch payload, then you can remove the STREAM profile and all of the STREAM statements.
when HTTP_REQUEST {
STREAM::disable
HTTP::header remove Accept-Encoding
inbound: replace Host header with internal name
HTTP::header replace Host "foo.example.com"
}
when HTTP_RESPONSE {
outbound: replace Host value (if it exists) in all headers
foreach x [HTTP::header names] {
if { [HTTP::header $x] contains "foo.example.com" } {
HTTP::header replace $x [string map {"foo.example.com" "external.domain.com"} [HTTP::header $x]]
}
}
outbound: replace Host value in payload
STREAM::expression {@foo.example.com@external.domain.com@}
STREAM::enable
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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