Forum Discussion
jgrohol_43248
Nimbostratus
Jun 28, 2010Port Translation
I've been struggling all day with this one... I have two separate problems and not sure if they are related.
1. I have a VS configured to listen on an IP and on port HTTP 80. I have it attac...
Michael_Yates
Nimbostratus
Jun 29, 2010You can replace anything in the Header if you know specifically what your looking for and want to replace it with.
The first example that I gave searches for a string "server1" and replaces it with a string "test1".
when HTTP_RESPONSE {
if { [HTTP::is_redirect] } {
HTTP::header replace Location [ string map {"server1" "test1"} [HTTP::header Location] ]
}
}
Or you could do something like what hoolio did and replace the URI instead of the Host:
Replace Host (URI::host) = http://devcentral.f5.com/wiki/default.aspx/iRules/URI__host.html
Replace Path (URI::path) = http://devcentral.f5.com/wiki/default.aspx/iRules/URI__path.html
when HTTP_RESPONSE {
Check if response is a redirect
if {[HTTP::is_redirect]}{
HTTP::header replace Location [string map -nocase "[URI::path [HTTP::header Location]] /some/value/index.html" [HTTP::header Location]]
}
}
If you are looking to do replacements in the body, you can do that too. The Stream Profile or Stream Expression is a good place to look for ideas:
http://devcentral.f5.com/wiki/default.aspx/iRules/stream__expression
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/241/iControl-101--18--Stream-Profile.aspx
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/101/LTM-stream-profile-Multiple-replacements-regular-expressions.aspx
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