GithubHelp home page GithubHelp logo

cdn-plugin's Introduction

Kirby CDN Plugin

This plugin will rewrite all URLs to assets, files in the content folder and thumbnails to direct to a CDN.

Setup

  1. Copy the cdn folder into site/plugins
  2. Add the following config options to site/config/config.php
c::set('cdn.assets', 'http://cdn.mydomain.com');
c::set('cdn.content', 'http://cdn.mydomain.com');
c::set('cdn.thumbs', 'http://cdn.mydomain.com');

That's it! Make sure you have a CDN at that url at all :) and it either has all the assets you are linking to uploaded, or it is setup as a pullzone.

You can switch off parts of it by simply passing false or not setting it:

c::set('cdn.thumbs', false);

Or you can of course use different CDNs or subdomains:

c::set('cdn.assets', 'http://assets.mycdn.com');
c::set('cdn.content', 'http://content.mycdn.com');
c::set('cdn.thumbs', 'http://thumbs.mycdn.com');

Cachebusting

In addition to the CDN plugin you might want to check out the cachebuster plugin to help you with cachebusting for CSS or JS files in order to avoid issues with cached assets after updates.

Beware with thumbs!

Enabling the CDN option for thumbnails might easily eat up your storage limit on your CDN unless your assets automatically expire after a certain time, because old thumbnails won't be deleted automatically.

Tested

This plugin has so far only been tested with http://keycdn.com. Please let me know if you run into any issues with other CDNs and feel free to submit improvements.

Author

Bastian Allgeier [email protected]

cdn-plugin's People

Contributors

bastianallgeier avatar corygibbons avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.