How to Integrate Prerender With Lovable Hosted Websites Using Cloudflare Workers Custom Domains
This guide helps you enable Prerender for a Lovable-hosted website while keeping your site on Lovable. It is designed for non-technical users and avoids common Cloudflare errors (like Error 1014 and Error 1000) by using Cloudflare Workers Custom Domains as the “front door”.
Before you start
You will need:
-
Your Lovable hosted URL (example:
yourapp.lovable.app) -
Your custom domain already added to Cloudflare (example:
app.example.com) -
Your Prerender token (from Prerender dashboard)
-
Access to Cloudflare Workers in your Cloudflare account
- Name Server set to CloudFlare
Important: Remove the custom domain from Lovable and A record from CloudFlare
To make this method work reliably, your custom domain should not be connected inside Lovable.
If Lovable still has your custom domain configured, it may force redirects that conflict with Cloudflare and create a “too many redirects” loop. Only one service can control the domain at a time, and in this setup Cloudflare must be the single “front door.”
What to do
-
Open your Lovable project
-
Go to Domains
-
Remove the custom domain (example:
app.example.com) -
Keep using the Lovable hosted address (example:
yourapp.lovable.app) as the upstream source
You can still use your custom domain publicly. Cloudflare will handle it and route requests to Lovable.
Step 1: Create a Cloudflare Worker
-
Log in to Cloudflare
-
Go to Compute → Workers & Pages

-
Click Create application

-
Choose Start with Hello World!

-
Name it something like
lovable-prerender -
Click Deploy
Step 2: Add your Prerender token to the Worker
-
Open your Worker
-
Go to Settings
-
Find Variables and Secrets
-
Add a Secret:
-
Name:
PRERENDER_TOKEN - Type: Plaintext
-
Value: (paste your Prerender token)

-
- Add the Lovable Upstream as a secret
- Name: LOVABLE_UPSTREAM
- Type: Plaintext
- Value: Lovable hosted address (example:
yourapp.lovable.app)
-
Save
Step 3: Attach your custom domain(s) to the Worker (Custom Domain)
This is the key step that avoids Cloudflare DNS limitations.
-
In your Worker, open Settings
-
Find Domains & Routes
-
Click +Add (add as many custom domains as many you need, including www)
The domain's nameserver must be Cloudflare.

- Select Custom domain

-
Enter your domain (example:
app.example.com)
-
Cloudflare will automatically create the needed DNS/certificate setup
When done, Cloudflare DNS will show a special Worker mapping for your domain.
Step 4: Paste the Worker code
-
In Cloudflare, open Compute → Workers & Pages → Your Worker
-
Click Edit code
-
Replace everything with the code on this link.
-
Save and deploy
Support
If you encounter any issues with this integration, please contact our support team for assistance.