Forum Discussion
Kevin_Stewart
Jan 29, 2014Employee
Here'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
}