Cloudflare Worker Setup

    Deploy the RenderBeam Worker that detects bots and serves cached HTML from the Cloudflare edge.

    Updated 5/4/2026

    Prerequisites

    About 10–15 minutes the first time.

    • A verified domain in RenderBeam
    • A free Cloudflare account
    • DNS for the domain pointed at Cloudflare (any plan, including free)

    Download the worker

    In Domains → your project → Setup, click Download worker.js. The file is pre-configured with your project ID and API key endpoint.

    Create the Cloudflare Worker

    1. Cloudflare dashboard → Workers & Pages → Create → Create Worker.
    2. Name it (e.g. renderbeam-worker) and deploy the placeholder.
    3. Edit code → replace everything with the downloaded worker.js.
    4. Deploy.

    Configure environment variables

    Settings → Variables. Add two encrypted variables:

    NameValue
    RENDERBEAM_API_KEYYour project API key (from the dashboard)
    RENDERBEAM_PROJECT_IDYour project ID

    Both are required — the renderer rejects requests missing x-api-key or x-project-id.

    Set up routes

    Triggers → Routes → Add route:

    text
    *yourdomain.com/*

    Attach to the zone for your domain.

    Verify deployment

    Click Test bot render in the RenderBeam dashboard, or:

    bash
    curl -A "Googlebot" -I https://yourdomain.com

    Look for X-Rendered-By: RenderBeam and X-Cache-Status: HIT|MISS.

    Loop prevention header

    Our renderer fetches your origin with the header X-RenderBeam-Skip: true. The worker is configured to always pass through any request carrying this header, so the renderer never accidentally calls itself. Don't strip this header in any custom logic.

    Troubleshooting

    • Worker not triggering — route pattern must include the wildcard prefix * and end with /*.
    • 401 / 403 from renderer — check both RENDERBEAM_API_KEY and RENDERBEAM_PROJECT_ID are set and encrypted.
    • Real users see errors — RenderBeam is fail-open by design; the worker passes through to your origin if rendering fails. If users still see errors, your origin itself is failing — see Fail-open behavior.
    • Bot not detected — verify the bot is enabled in Bots for the project; trial accounts are locked to the Standard preset.

    Was this page helpful?

    Keep exploring

    More resources to help you get the most out of RenderBeam.