Skip to content
  • There are no suggestions because the search field is empty.

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

  1. Open your Lovable project

  2. Go to Domains

  3. Remove the custom domain (example: app.example.com)

  4. 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

  1. Log in to Cloudflare

  2. Go to  Compute  Workers & Pages

  3. Click Create application

  4. Choose Start with Hello World!

  5. Name it something like lovable-prerender

  6. Click Deploy


Step 2: Add your Prerender token to the Worker

  1. Open your Worker

  2. Go to Settings

  3. Find Variables and Secrets

  4. Add a Secret:

    • Name: PRERENDER_TOKEN

    • Type: Plaintext
    • Value: (paste your Prerender token)


  5. Add the Lovable Upstream as a secret
    • Name: LOVABLE_UPSTREAM
    • Type: Plaintext
    • Value: Lovable hosted address (example: yourapp.lovable.app)

  1. Save


Step 3: Attach your custom domain(s) to the Worker (Custom Domain)

This is the key step that avoids Cloudflare DNS limitations.

  1. In your Worker, open Settings

  2. Find Domains & Routes

  3. Click +Add (add as many custom domains as many you need, including www)

    The domain's nameserver must be Cloudflare.

  4. Select Custom domain

  5. Enter your domain (example: app.example.com)

  6. 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

  1. In Cloudflare, open Compute  Workers & Pages → Your Worker

  2. Click Edit code

  3. Replace everything with the code on this link.

  4. Save and deploy

 

Support

If you encounter any issues with this integration, please contact our support team for assistance.

Was this article helpful?