Docs
← Back to site

Cloudflare Setup: R2 Storage and Ask AI on a Worker

5 min readUpdated November 21, 2026

If your site uses Cloudflare, WP Super Docs can set up two things for you with one API token:

  • R2 storage for the docs index. The docs index (the file external tools and Ask AI read) is pushed to a Cloudflare R2 bucket on every doc save and served from an address on your own domain.
  • Ask AI on a Worker (optional). A Cloudflare Worker answers Ask AI questions instead of your WordPress server. Questions go from the reader’s browser to the Worker, which reads the docs index from R2 and asks your AI provider. Your server isn’t involved, so heavy use or bots can’t slow it down.

Both are optional. The Worker needs the R2 storage, because it reads the docs index from there. If you’d rather set up storage yourself, the manual Index storage fields further down the same screen keep working as before.

Before you start#

  • Your domain must be on Cloudflare.
  • For the Worker: set up Ask AI first under WP Super Docs → Settings → Team & advanced → AI, with an AI provider and key. The Worker uses the same provider, model and key. Until a key is set, Deploy Worker is turned off and the card says so.

Step 1: Create the API token#

Go to WP Super Docs → Settings → Discoverability → Integrations and find Cloudflare setup. Click How to create the token for the list below.

Cloudflare setup card with the token field and the steps to create the token
  1. In Cloudflare, open My Profile → API Tokens → Create Token → Create Custom Token.
  2. Add these Account permissions: Account Settings: Read, Workers R2 Storage: Edit, Workers Scripts: Edit.
  3. Add these Zone permissions: Zone: Read, DNS: Edit, Cache Purge: Purge, for the domains you want to use.
  4. Create the token and copy it.

Step 2: Connect#

Paste the token into Cloudflare API token and click Connect. If the token can reach more than one Cloudflare account, choose one under Account and click Use this account.

The token is stored on your site, encrypted with your site’s keys. It’s kept so WP Super Docs can update the Worker when you change your AI settings, and clear the CDN cache after each index push. You can remove it at any time with Remove the token from this site; the R2 storage and the Worker keep running without it.

Step 3: R2 storage for the docs index#

Choose the address the index will be served from: a subdomain (default docs-cdn) and one of your domains. Then click Create storage. WP Super Docs:

  1. Creates the R2 bucket.
  2. Connects your chosen address to it.
  3. Fills in the Index storage settings below the card.
  4. Pushes the docs index.

When it’s done, a tick shows the bucket name and its address.

A new address can take a few minutes to start working while Cloudflare sets up its certificate.

Step 4: Ask AI on a Worker (optional)#

Choose the Worker’s address: a subdomain (default docs-ai) and one of your domains, or workers.dev (no domain) to use your Cloudflare account’s free workers.dev address. The Worker can’t use the same address as the R2 storage. Then click Deploy Worker.

When it’s done, a tick shows the Worker’s name and address, and Answer Ask AI with the Worker is turned on. From then on:

  • Ask AI questions are answered by the Worker.
  • If the Worker can’t be reached, Ask AI answers from WordPress as before, so readers always get an answer.
  • A new address can take a few minutes to work while Cloudflare sets up its certificate. Ask AI uses WordPress until then.
Cloudflare setup card with R2 storage and the Ask AI Worker set up

Untick Answer Ask AI with the Worker to go back to WordPress without removing anything. Remove Worker deletes the Worker from Cloudflare and Ask AI goes back to running in WordPress.

How it’s named#

Everything WP Super Docs creates is named after your site, so it’s easy to find in your Cloudflare dashboard. For https://example.com, the bucket and the Worker are both called example-com-wpsuperdocs. The card shows the name for your site at the top.

When you change AI settings#

The Worker carries your AI provider, model, key, custom instructions, rate limit and answer cache time. When you change any of them under Settings → AI, WP Super Docs updates the Worker automatically. If that update fails, a notice at the top of wp-admin says why, with an Open the Cloudflare settings link. There, Deploy again retries it.

What works the same on the Worker#

The Worker answers the same way as Ask AI in WordPress:

  • It finds the same matching docs and sends the same passages and instructions to your AI provider.
  • It uses your Ask AI rate limit (questions per visitor per hour). On the Worker, the count is kept per Cloudflare location, so a visitor whose requests reach two locations can ask a few more questions than the limit.
  • It reuses answers to the same question for as long as your Ask-AI response cache TTL says.
  • Only your own site can call it. Requests from other websites are refused.

One difference: answers from the Worker are not counted in the AI token usage figures on the Dashboard.

See What Data Is Sent to AI Providers for exactly what the Worker sends.

Uninstalling#

Uninstalling WP Super Docs doesn’t delete the bucket or the Worker from Cloudflare. Remove the Worker with Remove Worker first, and delete the bucket in your Cloudflare dashboard if you no longer need it.

Was this helpful?

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only