Roundtable bot-gate for Cloudflare Pages
npm install roundtable-cloudflare-bot-gateAdds Roundtable's auto‑block gate to any existing Cloudflare Pages project. The block‑list lives in Cloudflare KV, so a hot lookup adds only ~1 ms of latency.
Setup should take 15 minutes max.
---
``html`
src="https://cdn.roundtable.ai/v1/rt.js"
data-site-key="YOUR_SITE_KEY"
data-auto-block="true"
data-user-id="OPTIONAL_USER_ID">YOUR_SITE_KEY
Get at
`bashAdd dev dependency
npm i -D roundtable-cloudflare-bot-gate
init does two things:
1. Adds functions/_middleware.js and functions/rt-block.js.
2. Generates a 64‑char RT_WEBHOOK_TOKEN and prints it.$3
`bash
echo | wrangler secret put RT_WEBHOOK_TOKEN
`Use the token printed by
init.$3
Create the namespaces and copy the generated IDs:
`bash
wrangler kv namespace create RT_BLOCKED # copy the production ID
wrangler kv namespace create RT_BLOCKED --preview # copy the preview ID
`Then add the binding to your Wrangler config:
For
wrangler.jsonc:
`jsonc
{
"kv_namespaces": [
{
"binding": "RT_BLOCKED",
"id": "abcd1234...", // paste production ID here
"preview_id": "wxyz5678..." // paste preview ID here
}
]
}
`For
wrangler.toml:
`toml
[[kv_namespaces]]
binding = "RT_BLOCKED"
id = "abcd1234..." # paste production ID here
preview_id = "wxyz5678..." # paste preview ID here
`$3
Send the token printed in step 2 and your webhook endpoint to so we can enable blocking for your site.
`
Endpoint: https:///rt-block
Token:
`$3
`bash
wrangler pages deploy
`
Roundtable will now write sid: into RT_BLOCKED` when it detects fraud; the middleware returns 403 on the very next request.---
Email