How to cache assets
Speed up your site by caching your resources and reducing costly Object Storage Providers (OSP) bandwidth with Cassette (all without changing your source code).
Resources stored on popular OSP's like Amazon S3 and Google Cloud Storage aren't cacheable on Cloudflare if they are served directly from the OSP.
For example, if your img elements look similar to <img src='my-bucket.s3.amazonaws.com/cat.jpg' />, you're site is slower and costs more than it should.
But don't worry, Cassette solves this problem by rewriting your OSP resources to fetch from a subdomain you control enabling Cloudflare to cache your assets.
We used the following options to set up Cassette.
If your bucket has a path style URLs
like s3.amazonaws.com/my-bucket, set the
Object Storage Pathname install option to
Once installed, Cassette replaces references to
Object Storage Hostname with
Our website's source code contains an
<img src='network-chimp.s3.amazonaws.com/cassette/image.jpg' />. Cassette enables Cloudflare to cache the image by swapping the
hostname with assets.networkchimp.com before your browser loads the
Look for the
CF-Cache-Status=HIT header in the image request to
confirm its cached.