Skip to main content
Cloudflare

Cloudflare #

Pages #

While using longern/FlareDrive (link points to my fork with more detailed instructions)1, I tried out Cloudflare Pages.

Authentication #

Any custom domain needs to use Cloudflare as its DNS in order for it to be added as a self hosted application in Zero Trust.

Which means that you have to add the domain (not only the subdomain, the entire domain) to your Cloudflare websites, switch its DNS to Cloudflare (instructions will be given), and then jump back and forth between Pages & Zero Trust dashboards a few times to setup the authentication policy. Not ideal.

Make sure you export all your DNS settings from your previous DNS provider before pushing the confirm switch button! The Cloudflare DNS auto-migration process has dropped several subdomain settings of mine.

Binding your R2 bucket #

Go to ProjectSettingsFunctionsR2 bucket bindings, then add variable names and select buckets. Do not use Environment variables.

R2 #

Location hint #

According to docs, currently, if you have set a location hint for bucket named name, then even if you delete it and create another bucket called name, it will still keep the previous location hint. This cannot be changed.

R2 as static image storage #

Ref: Serve static assets with Cloudflare R2 - BrettOps

You can use tools like Cyberduck to easily view and manage the R2 storage, include uploading images.

PicGo S3 plugin #

Reference: S3 API compatibility · Cloudflare R2 docs

Generate access token:

Go to R2 OverviewManage R2 API TokensCreate API token, choose Write permission, and then note down the Access Key ID and Secret Access Key.

PicGo S3 settings:

应用密钥 ID / accessKeyID
<Access Key ID>
应用密钥 / secretAccessKey
<Secret Access Key>
桶名 / bucketName
<Name of your bucket>
文件路径 / uploadPath
Customisable name, see plugin docs. I have {year}-{month}-{day}-{fullName}.
地区 / region
auto
自定义节点 / endpoint
https://<Account ID>.r2.cloudflarestorage.com, the link in bucket page, minus the bucket name
自定义域名 / urlPrefix
Link prefix you would like to copy. I have https://<Random ID>.r2.dev for now.

uPic #

ver 0.21.1, AWSSDKSwiftCore.AWSReponseError error 1. I suspect it is because there is no auto region in uPic/uPic/Models/S3/S3Region.swift, but I do not speak Swift.

Zero Trust #

In order to use Zero Trust, you must fill out the payment method form (even for the free tier).


  1. The only problem with this project is that the contextual menu does not work at all on iOS devices. ↩︎