How to use Fastly CDN with B2 How to use Fastly CDN with B2

How to use Fastly CDN with B2

Udara Gunawardena Udara Gunawardena


The Fastly Content Delivery Network allows you to cache your data using multiple servers across the world, dramatically reducing the amount of latency involved with accessing it. In this article, we will be going over the steps involved with setting up Fastly CDN as a front end for your public B2 bucket. 



Creating your B2 bucket 

  1. Create a public bucket on your Backblaze account. In this case, we are naming the bucket myb2content


  2. In this particular demo, I have uploaded a jpeg resource named iris-8.jpeg into my newly created bucket. Take note of the S3 URL field. 



Configuring your Fastly service

  1. If you already have a domain name configured, type in the domain name.  If not, you can configure your own that will at least temporarily (until the domain is registered) be addressable at the following address.


    In this demo, I will be naming my website

  2. Under Origins -> Hosts, create a new host with the hostname you gathered earlier from your bucket.

    In this scenario using the S3 URL, our hostname will be the URL past the bucket name.


  3. Press the pencil icon next to the hostname to edit the parameters of the host. Here we make sure Certificate Hostname, and SNI Hostname is the same as our base address.


    Then we set the Override Host to the full S3 URL we gathered above including specifically the bucket name.

  4. Update the host and now you should be able to activate the service. You should now be able to navigate to any object stored in your b2 bucket by appending its path to your domain name.

    For example, navigating to will display the jpeg picture of a car. 




For more details on different approaches to setting up your Fastly CDN including instructions on how to set it up against a private bucket please visit their documentation