. 1 min read
To improve the performance of a site, Use Cloudflare as CDN. However, Cloudflare's caching is not very effective for infrequently accessed files or large files. To handle these types of files, Wasabi's S3 storage service is best. Wasabi is cost-effective because it doesn't charge fees for egress or API requests, only for storage. While Wasabi does offer public access, the speed may not be as fast as other options. Fortunately, Wasabi and Cloudflare have a partnership, which allows me to use both services to optimize my site's performance. For more information, you can read about the partnership between Wasabi and Cloudflare here: https://wasabi.com/solution-brief/cloudflare/.
First, make a new bucket in Wasabi. Have it reflect the name of your domain or subdomain. Make sure that it shares the same name as either your domain or your subdomain!
The name of the bucket in this example is cdn.developerbook.net
.
You can select any region you like, best is nearest to your website server.
Next, you will need to create a Bucket Policy, which will make each and every file stored in your bucket automatically accessible to the public world wide.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::cdn.developerbook.net/*" } ] }
The critical bit is changing the ARN “arn:aws:s3:::cdn.developerbook.net/*
” to your bucket name.
On Wasabi, all you need to do is upload the files you wish to serve; beyond that, there is nothing else to do.
To use Wasabi as your CDN, you need to create a CNAME record in the DNS section of your Cloudflare account. Cloudflare offers a unique feature called CNAME Flattening, which allows you to set a CNAME on the root of your domain and point it to Wasabi. This allows you to use Wasabi as your CDN by pointing cdn.developerbook.net
to Wasabi.
Without a page rule, Wasabi will return an XML page that lists all the files in the bucket. While this is fine because all the files are publicly accessible, you may want to redirect users back to the main page instead.
After creating page rule. https://cdn.developerbook.net, configured it to redirect to the main site https://developerbook.net.
Note: after testing the wasabi with cloudflare i had deleted the DNS records from Cloudflare.