cf-storage

cost

https://developers.cloudflare.com/r2/pricing/

10GB / month free

  • $0.015 per additional GB / month

turn on

创建 Bucket

Click [Create Bucket] in the upper right corner and enter

  • Bucket name: You can customize it. It can be related to your application, business, and storage content for easy distinction
  • Location: Automatically assigned
  • Click the [Create] button to complete the creation

turn on R2 subdomain

Use R2 with APIs

Use the curl command below to create a new bucket. Visit documentation to access the full list of API endpoints.

curl https://api.cloudflare.com/client/v4/\
accounts/1234/r2/buckets \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_TOKEN" \
    -d '{ \
                "name": "my-bucket", \
                "locationHint": "enam" \
            }'

errors log

Personal problem record

After I successfully uploaded to PicGo, the returned address is as follows

However, I cannot access this address directly after entering it into the browser, and the prompt is as follows:

<Error>

<Code>InvalidArgument</Code>

<Message>Authorization</Message>

</Error>

The URL generated by the R2.dev subdomain can be accessed normally after splicing

R2.dev subdomain/Obsidian/ShotEasy%20%2810%29.png

Problem solution

I modified the custom output URL in PicGo settings The template sets the returned link format:

custom domain name/{path}

After setting, the default link returned is: custom domain name/Obsidian/ShotEasy%20%2810%29.png