/ how to

Use Dropbox for static file delivery

Not a new idea i guess, but a convenient and cost-efficient way to separate binary content from my blogs text and metadata is to copy all the images and other static data to dropbox and link to it with a public sharing link and the ?dl=1-parameter as described in this article at the dropbox help center.

The benefits are:

  • Workflow-friendly local file management, editing and syncing
  • Always at least one local backup of all files on disk
  • The structure of a shared link is consistent and easy to migrate if needed: https://www.dropbox.com/s/<hash>/file_name.ext?dl=1

Important note: Dropbox is not a CDN and i'm pretty sure they have some throttling in place. A big bummer is that dropbox does not even set a caching header for client-side caching.


For the sake of completeness: Of course you can put a CDN like Amazon AWS CloudFront in front of the Dropbox-delivered files. After that, you can convert your links from:

https://www.dropbox.com/s/<hash>/file_name.ext?dl=1

to

https://<id>.cloudfront.net/s/<hash>/file_name.ext?dl=1

or even use a CNAME entry in your DNS pointing to <id>.cloudfront.net which would result in:

https://<your-domain>.tld/s/<hash>/file_name.ext?dl=1

Nifty, right?

It is important to keep the ?dl=1 all the way and configure your CDN to allow query parameter passing (usually they get stripped in the process).