Forum Discussion
hooleylist
Nov 03, 2009Cirrostratus
Hi Hamish,
Yes, STREAM::expression accepts variables. Just make sure to wrap the string in double quotes instead of curly braces.
Also, I think you'll need to save the HTTP::host value in HTTP_REQUEST. And it would be good to only enable the stream filter for text responses when the client used a host header.
http://devcentral.f5.com/Wiki/default.aspx/iRules/STREAM__expression.html
when HTTP_REQUEST {
Save the host header value
set host [HTTP::host]
}
when HTTP_RESPONSE {
Disable the stream filter by default
STREAM::disable
Check if response type is text
if {[HTTP::header value Content-Type] contains "text" && $host ne ""}{
Replace any instance of the requested with newhost.example.com
STREAM::expression "@$host@newhost.example.com@"
Enable the stream filter for this response only
STREAM::enable
}
}
Aaron