Forum Discussion
iyanus_39384
Dec 01, 2010Nimbostratus
Outbound iRule STREAM Rewrites for CDN
Hi Folks,
We have a legacy app that has a lot of static content that we want to move to a CDN. I have succesfully created a stream profile to do some of the outbound translation, however th...
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
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