Jump to content

Community Guide on Setting Up Backblaze and CloudFlare

Recommended Posts

Hello 🙂

(This is a community guide on how to setup Backblaze and Cloudflare, as a significantly cheaper replacement for Amazon S3 and Cloudfront.  The author has no affiliate arrangement with any of the companies listed in the guide and offers the guide as a free community resource.  You should consult with your hosting provider and / or server administrator before proceeding with the guide.)

The tutorial is tested with the latest version of Invision 4.5.4 !

Invision Community allows a file storage configuration with Amazon S3 and a content distribution network (CDN) of your choice:






Backblaze is an infinitely Scalable B2 Cloud Storage. Backblaze B2 is enterprise-grade, S3 compatible storage that companies around the world use to store and serve data. Backblaze's service works with native APIs, CLI, and GUI; you can move and manage data with minimal coding. Their service provides fast access all the time; there is no need to accept delays or pay speed surcharges. It can also support HIPAA compliant storage with their Business Associates Agreement (BAA). B2 is compatible at ¼ the cost of AWS S3 with no hidden fees or minimums.


Backblaze is an award winning cloud storage provider for 2020 !







Based on their latest pricing, it is very cheap at around 5$ per 1TB storage per month! There is a cost for direct downloads (bandwidth) at 0.01$ per GB but it will not affect us as we will use Cloudflare and all files will be served from Backblaze to Cloudflare and then to users that is totally free 🙂

Be careful if you have any custom direct downloads that bypass Cloudflare. If you link to custom downloads directly, you will be charged for bandwidth. All default Invision files should go through Cloudflare. I am using Backblaze for a few of my clients and they never charged anything extra as all Invision files are going through Cloudflare as expected. Please monitor your balance after a few days just to be sure!





STEP 1: Create a bucket on Backblaze

First we need to sign up at Backblaze Cloud: https://www.backblaze.com/b2/sign-up.html

You will need a phone number to activate your account:


After the activation of the account we will need to create a bucket that will host our files.


On the Buckets sections we click on Create a Bucket:



Then we add a name for our bucket. Recommendation: avoid dots (.) in the bucket name.


On the next screen we type a Bucket name and we select Public and then we click at Create a Bucket.




After that under the Create a Bucket we should have our Bucket.


Now we must keep a note of the ENDPOINT:




Now we need to get our Bucket access keys from the App Keys menu. At the bottom we click at Add a New Application Key:




At the new screen we select a anything as a key name and we keep selected the Read and Write access and wee click at Create New Key:




Then you will see there only once the KeyID and the Application Key that we must keep a note of them as we will need them later !



As a last step we need to go to our bucket that we just created and upload an image. From the menu on the left we click on Browse Files and then we click on our bucket:



Then we click on upload and we upload a simple file like an image...



On the right side of the uploaded image we have to click at the info icon:



At the pop up screen we need to keep a note for that part so copy it with the other notes that wee have already:



That's it ! We created our bucket and we got the access info that we will need !


STEP 2: Create a CNAME dns record at Cloudflare


Now you have to login to Cloudflare and go to your DNS tab from the top menu and then click Add record:




We use as Type the Cname and as Name the cdn and as Target the info that we got from the pop on the previous step in the tutorial above:



After saving that DNS record we should have that:



Now for security reasons we have to go to the page Rules on the top menu and create two rules:


Just replace your domain and the bucket name that you create:




Just replace your domain:



The final result should be like this:



Keep in mind the order of the rules as if you set the second rule as 1 it will not work and your forum images will not work as page rules uses priority. This is important!

That's it for the Cloudflare part!


STEP 3: Configure Invision to use the Backblaze Cloud

From Invision Admin Control Panel, go to System -> Files -> Storage Settings



Then we click on Configurations:



and then on Create New on the right side.

Then we select Amazon S3 and we fill the needed info as:



When you click Save if you get any warnings or errors then you have to check again the tutorial as you may forgot something or may have a typo somewhere...

If you save it without any issues then you are ready to use it by going to: System -> Files -> Storage Settings

and select a category with not many images for example Icons & Logos or anything else with a few images and from the drop down options the: Amazon S3:superbucket




Then wait for the automated task to transfer your files to the Cloud and check if all are ok !

If yes then you can proceed with the rest categories.


*Keep only at your server your theme resources:



Keep in mind that if you have a lot of GB of files it may take a long time for the transfer !


It may help to go to the Dashboard and run manually the process to get the files transferred faster.

*Attachments and Downloads may not work out of the box (don't use them on my test forum and i don't know for sure) and you may need to use the addon S3 Compatible Downloads:


I hope that you will benefit from this tutorial and get better performance while saving space on your main server and a lot of money 🙂

Backblaze is much more stable than Wasabi!

It also includes up to 10GB free storage, so you can test it easily !

Credits to: @Joel R and @Martin A.

Enjoy !

Edited by ASTRAPI
Link to comment
Share on other sites

  • 1 year later...

If you're having trouble with redirection "This page has redirected too many times", check that your SSL mode for the domain is set to "FULL". Traffic to Cloudflare is always encrypted over HTTPS, and this ensures that the traffic between Cloudflare and Backblaze is also encrypted.

The alternative, flexible mode, the communication between Cloudflare and Backblaze is conducted over plain HTTP traffic. Backblaze doesn't allow unencrypted traffic and your browser gets stuck in a redirect loop.

Be aware: Changing this setting to FULL may break other proxied hostnames in your domain if they're not also capable of running over HTTPS independently. If you have any problems, make sure all your proxied hosts have certificates installed (self-signed or otherwise. Free Let's Encrypt certificates work fine). Contact your web host if you don't know what that means. Or turn the SSL mode back to "Flexible" just use the plain Backblaze URL for your offloaded media by setting the Custom URL in Invision to "https://f0002.backblazeb2.com/file/<BUCKET>/"  (Whatever your bucket's URL is). You won't get a fancy cdn.yourdomainname.com address, but it should be better supported.


Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...