How do I integrate Prerender with Cloudflare Workers?
Route AI crawler and search engine requests through Prerender using a Cloudflare Worker script — no server access required.
TL;DR
Connect Prerender to your Cloudflare-proxied website by deploying a Workers script that intercepts crawler requests and routes them through Prerender's rendering solution. You'll need Cloudflare Worker Admin access and your Prerender token. Setup takes about 15–20 minutes, and the integration starts working within a couple of minutes of final deployment.
ℹ️ Using Lovable? If your site is hosted on Lovable, follow the Lovable integration guide instead — the setup path is different.
ℹ️ Not sure which integration fits your stack? Ask Nexus, your AI integration assistant inside your Prerender dashboard — describe your setup and Nexus will recommend the right path and walk you through it.
Step 1: Open your Prerender dashboard and copy your token
- Log in to your Prerender dashboard.
- Go to Security and Access and copy your Prerender token.

ℹ️ Don't have a Prerender account yet? Sign up at prerender.io before continuing.
ℹ️ Keep your token private — anyone with it can send requests through your Prerender account. You'll add it to the worker as an environment variable in Step 6.
Step 2: Confirm Cloudflare is proxying your domain
This integration only works when Cloudflare is acting as a proxy for your domain — not just as a DNS provider.
- Open your Cloudflare dashboard and go to DNS > Records for your domain.
- Check that your A record or CNAME has the Proxied status — the orange cloud icon.
⚠️ If the cloud icon is grey (DNS only), Prerender will not intercept crawler requests. Switch it to Proxied before continuing.
ℹ️ If you run into issues with the integration while using an A record, replacing it with a CNAME record in Cloudflare should resolve the problem.
Step 3: Allow AI crawlers in Cloudflare
Cloudflare automatically blocks AI training crawlers on newly added domains. If you want AI crawlers to discover and index your content through Prerender, you must explicitly allow them.
- From the Account Home menu, select your domain.
- On the Overview page, find Control AI crawlers and set it to allow.
ℹ️ For details on how Cloudflare categorises AI crawlers, see Cloudflare's bot documentation.
Step 4: Create a new Cloudflare Worker
- In your Cloudflare dashboard, go to Compute and AI > Workers & Pages.
- Click Create Application and select Start with Hello World!
- Name the worker (for example,
prerender-worker) and click Deploy.
- Click Edit Code in the top right.
- Copy the Prerender worker source code from GitHub, paste it into the editor, and replace the default Hello World code entirely.

- Do not deploy yet — continue to Step 5 first.
Step 5: Configure the worker route
- Go to your worker's Settings tab and select Domains & Routes.
- Add a route that matches the domain where you want Prerender to run. Use the patterns below:
Website Route pattern example.comexample.com/*www.example.comwww.example.com/*Both with and without www *example.com/*Any subdomain *.example.com/*Specific subdomain blog.example.com/* - Set Failure mode to Fail open (proceed).

- Save the settings.
Step 6: Add your Prerender token as an environment variable
- Still in Settings, go to Variables and Secrets.

- Add a new variable with these values:
- Type: Text
- Variable name:
PRERENDER_TOKEN - Value: paste the token you copied in Step 1

- Save the variable.
Step 7: Deploy the worker
Click Deploy to push the worker live. 
ℹ️ It may take a couple of minutes after deployment before the integration starts intercepting requests.
Step 8: Verify your integration
Before you consider the integration complete, confirm that Prerender is correctly intercepting crawler requests and serving rendered HTML.
Follow the steps in How do I verify my Prerender integration? to test your setup.
✅ Your integration is working when cached pages appear in your Prerender dashboard within a few minutes of your first crawler request, and Prerender response headers are visible in the verification tool.
If you don't see Prerender headers or IDs in the verification output, the integration is not active. Check that your worker route pattern matches the URL you're testing and that the PRERENDER_TOKEN variable is saved correctly in your worker settings.
If you see the message "Prerender Integration Not Detected," follow the steps in What should I do if I receive a "Prerender Integration Not Detected" error? to resolve it.
💬 Still need help?
If you're running into issues with your Cloudflare Workers integration, our support team can help you diagnose what's going wrong.
→ Contact us atsupport@prerender.io