Forum Discussion
karthik_sriniva
Nimbostratus
Oct 28, 2005Stream Profile: Replace String
Hi Guys,
I had configured a virtual server for our secure site. The content is legacy code and it has hardcoded urls for http. Currently I am using stream profile to replace all the http:...
hoolio
Cirrostratus
Nov 03, 2009Hi 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
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
