Forum Discussion
hooleylist
Dec 02, 2010Cirrostratus
Hi Iain,
You should be able to do this with a STREAM::expression based iRule. In HTTP_RESPONSE, set the STREAM::expression to:
http://devcentral\.f5\.com/path/to/static/asset\.(?:jpg|gif|png|swf)
Then in the STREAM_MATCHED event, you can retrieve the full match using STREAM::match and rewrite the string using string map:
when STREAM_MATCHED {
log local0. "[IP::client_addr]:[TCP::local_port]: matched: [STREAM::match], replaced with: [string map {http://devcentral.f5.com/ http://my.cdn/} [STREAM::match]]"
STREAM::replace "[string map {http://devcentral.f5.com/ http://my.cdn/} [STREAM::match]]"
}
For details on the HTTP_RESPONSE code, check the STREAM::expression wiki page:
http://devcentral.f5.com/wiki/default.aspx/iRules/stream__expression
Aaron