Mojolicious::Plugin::AssetPack::Manual::CustomDomain - How to serve assets from a different host
You might want to serve the assets from a domain different from where the main app is running. The reasons for that might be:
No cookies send on each request. This is especially useful when you use Mojolicious sessions as they are stored in cookies and clients send whole session with every request.
More requests done in parallel. Browsers have limits for sending parallel request to one domain. With separate domain static files can be loaded in parallel.
Serve files directly (by absolute url) from CDN (or Amazon S3).
To use the feature, just set a custom "base_url":
plugin "AssetPack" => { base_url => "http://cdn.example.com/my-assets/", };
See also https://developers.google.com/speed/docs/best-practices/request#ServeFromCookielessDomain.
Jan Henning Thorsen - jhthorsen@cpan.org
jhthorsen@cpan.org
To install Mojolicious::Plugin::AssetPack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::AssetPack
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::AssetPack
For more information on module installation, please visit the detailed CPAN module installation guide.