[Catalyst] New plugin Catalyst::Plugin::ExternalURI

Jose Luis Martinez jlmartinez-lists-catalyst at capside.com
Mon Oct 21 17:05:25 GMT 2013


	I finally got around to publishing a little plugin that we've had 
running internally for some time now: Catalyst::Plugin::ExternalURI.

	When you're working with CDNs or AWS S3 Buckets where you leave static 
files like videos, css, js, etc (to have them served from S3) and you 
have written all your links with [% c.uri_for('/static/assetX') %], this 
plugin helps you rewrite the output of c.uri_for so that it doesn't 
point back to your app server.

	One benefit is that you can upload static files to /versionX/static/, 
and have the plugin prepend the version of your application to the URIs. 
That way, when deploying a new version you don't have cache problems (as 
the URLs are different), and you don't have to do anything to your 

	Also we will have "devel mode" (the plugin will not rewrite URLs) and 
production mode, where the offloading to S3 is supposed to happen with 
something like this:

     externaluri => [
         ($ENV{'APP_MODE'} eq 'development')?{ '^/static' => '...' }:()

Hope it helps somebody. Sure did help us :)

Jose Luis Martinez
jlmartinez at capside.com

More information about the Catalyst mailing list