Backblaze B2 Static Website

Posted : admin On 1/29/2022

May 13, 2020 My bucket contained a static website containing adaptive streaming video content stored in a Backblaze B2 bucket. Note: We permit caching of third party video content only for enterprise domains. Free/Pro/Biz users wanting to serve video content via Cloudflare may use Stream which delivers an end-to-end video delivery service. To use B2 Cloud Storage you need an account on the Backblaze website, it can be the same account as a Personal Backup account, but not if you have a business or group account apparently (I have a group account on Backblaze and I cannot turn on B2 Cloud Storage). Once you have a B2 account you need to create a bucket to hold your files.


If you’ve been around the ol’ static website hosting block a few times, you’veprobably come across the possibility of hosting your site out of Amazon S3 andmaybe sticking Cloudfront in front of it for good measure. That stack lookslike the image below, assuming we use Amazon for everything.


The big three cloud providers all have their bucket solutions, which is to saythey all provide a way to store files without havingto worry about hard drives. Amazon’s bucket service is called “S3” (short forSimple Storage Service), Google’s is called “Cloud Storage”, and Microsoft’sis called “Blob Storage”.


In recent years a new challenger has appeared, acompany called Backblaze has begun offering a service called “B2” that is wildlycheaper than the competition. I’m always rooting for the underdog, so let’stake a look at hosting a static website from B2.

Using B2 to Host a Site?

B2 does allow you to set a bucket to “public”, and then provides a url whereanyone can download the files. That’s a good start, but there are three problemsthat stand between us and an awesome static website.

  • 1: The url B2 provides isn’t exactly something that would make for a catchywebsite name.
  • 2: Files served out of B2 don’t have the right content-type headers present.For example, if I type in the path to an index.html file hosted on B2, itprompts me to download the html as a file, rather than rendering it as awebpage.
  • 3: There are some nice things that webservers tend to automatically do, likeserving an index.html file if the user requests a base path like “/”

Luckily we can solve all three issues using a cdn service called Cloudflare.With that addition, our B2 static hosting stack looks like this:

Cloud Workers

Cloudflare has a bunch of different services, but there’s really only one weneed for this project: Cloud Workers. Cloud Workers let you write littlescripts that get called when a user requests a url. We’ll be looking at theurl that the user requested, loading the specified file from B2, adding inthe right content-type headers, and then serving the file back to the user.Here’s the script I put together for the cloud worker:

I’ll admit, writing a somewhat complex script was not what I had in mind when starting on the project. Sometimes the internet is just a crazy place.

Backblaze B2 Static Website Login


Here are some completely un-scientific and un-trustworthy download speed resultsfor loading a 53kb javascript file:

  • B2 Stack (Cache miss): 700ms
  • B2 Stack (Cache hit): 239ms
  • S3 Stack (Cache miss): 498ms
  • S3 Stack (Cache hit): 230ms

In case you’re wondering, “Cache miss” means that the file was not found at theCDN layer. That’s Cloudfront for the S3 stack or Cloudflare for the B2 stack.Since the file is not found in the CDN, the CDN will load the file from theorigin and then serve it, usually with some kind of header indicating a“cache miss”. If the CDN has the fileit can provide it right away, resulting in a faster “cache hit”.


B2 is considerably cheaper than S3, but it’s kind of like saying 0.00001 dollarsis ten times cheaper than 0.0001 dollars. Storage is so cheap that you probably won’t care,unless you’re hosting large video files or something that will take up hundredsof gigs of storage.



As much as I would like to pull for the underdog, the S3 stack is considerablyeasier to set up and use. S3’s UI is nicer to use. S3 can serve your filesdirectly without needing to write a script that runs on every request.The B2 stack is cheaper, but for small to medium sites the difference will benegligible.

Oct 14, 2019

Backblaze B2 Cloud Storage

Backblaze is a company offering unlimited online backup services. In June 2016, they launched the official version of Backblaze B2 Cloud Storage, a metered object storage service. Backblaze B2 Cloud Storage is characterized by price, it is the lowest price compared to other object storage services like Amazon S3 (Cloud Storage Comparison). Just by registering your email address, you can use 10GB free service with no time limit. If you use more than 10GB you will need to register your payment information, but you can continue to use the first 10GB free.

You have two choices to back up your files to Backblaze. The first one is Backblaze B2 Cloud Storage with a backup application like qBackup. The second one is Backblaze Unlimited Backup. Each has its own characteristics, which one is better to choose depends on the situation. Refer to the table below.

Backblaze B2 Static Website
Backblaze B2 Cloud Storage with qBackupBackblaze Unlimited Backup
Trial10GB Free with no time limit15-day free
Storage Pricing$0.005/1GB/month (*1)$5/month (per computer)
Backup ApplicationqBackup (Windows/Mac/Linux)Backblaze Client Software (Windows/Mac)
RestoringDirectly restore files/folders from qBackup

Restore from Backblaze website
- Download Zip File (free)
- USB Flash Drive ($99)
- USB Hard Drive ($189)

Backup Exclusions-NAS, Time Machine, etc.
File VersionsNo limitationUp to 30 days

(*1) Additional fee may be charged for downloading and transactions.

qBackup is listed on the Backblaze B2 Integrations. This page introduces how to backup to Backblaze B2 Cloud Storage using qBackup.

Sign up for Backblaze B2 Cloud Storage

Go to Backblaze B2 Cloud Storage, enter your email address and password, and click [Sign Up for B2].

Select [App Keys] from the B2 Cloud Storage menu.

Your keyID is displayed on this page. Click [Create New Master Application Key] to create an Application Key.

qBackup uses the keyID and the Application Key to access Backblaze B2 Cloud Storage.

Installing qBackup

Download qBackup installer, and run the installer and complete the installation according to the instruction.

Creating project (backup configuration)

Run qBackup, and click [New] on the toolbar.

Enter project name.

Backblaze B2 Storage

Adding backup sources

Select [Include], and add files and folders to be backed up.

Files to be backed up

Any number of files and folders can be added.
You can add and delete files after backup is executed.
You can specify exclusions on [Exclude].


Select [Storage] and set storage information.

Storage typeBackblaze B2 Cloud Storage
Key IDThe keyID confirmed on Backblaze website
Application KeyThe Application Key created on Backblaze website
Bucket nameThe bucket name must be unique for the entire Backblaze B2 Cloud Storage. qBackup creates a bucket if it doesn't exist. We recommend that you create a dedicated bucket for qBackup.
PrefixSpecify if you want to create a virtual folder in the bucket. The prefix enables you to create multiple backups in the bucket. If the prefix is blank, backup data will be created just beneath a bucket.


Select [Options] and set each item as necessary. Backup can be executed even in the initial state. Set encryption password if you need to encrypt backup data.

Uploading speed

If the uploading speed is slow, you may be able to improve by changing the [Max threads] (Storage).

Backblaze B2 Price

Click [OK] to save the project.

Backing up

Select the project you created. Click [Backup] on the toolbar to start backup.

The processing status is displayed on the window during backup.

When the backup is completed, the processing status becomes [Complete].

For the second and subsequent backups, only changes from the previous backup are backed up (incremental backup).

Restoring backed up files

Select the backup you want to restore and click [Storage] on the toolbar.

The files backed up in the storage are displayed.

Sample Static Website

Select the files/folders you want to restore and click [Restore].

Backblaze B2 Static Website Free

Find files to be restored

By double-clicking a folder, you can move into the folder.

On the window that appears, enter conditions such as the destination and click [OK].

The processing status is displayed as in the case of backup.

Backblaze B2 Cloud Storage

For more information please refer to the documentation of qBackup and Backblaze B2 Cloud Storage.