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

Firebase

This guide will guide you on integrating Prerender with your Firebase Hosting project using Cloudflare as a proxy on the domain and then implementing a Cloudflare worker.

Video guide:

 

 

Prerender token 

The location of the Prerender token has changed. You can find it under the Security and Access menu under Prerender Token.

You can find the integration's source code on this link.

Text guide:

1. Begin by integrating Cloudflare with your domain. 
This requires you to go to your domain registrar's DNS settings, remove the existing name servers, and replace them with the ones provided by Cloudflare.
Access the DNS menu in Cloudflare to find the necessary name servers.
image-1707394080355
2. Update DNS Records in Cloudflare

Save your changes in Cloudflare, then add the DNS records we get from Firebase.
Navigate to Firebase, select your project, and add your domain as a custom under Build -> Hosting menu point. Add the A and TXT records provided by Firebase to Cloudflare, ensuring the proxy status is enabled for the A record.
image-1707394182693

3. Verify Domain with Firebase

After adding the DNS records, use Firebase's "Verify" option to confirm the setup. The DNS update process may take a few minutes, so feel free to proceed with the next steps. 

4. Configure Additional Domains

If you have a www version of your domain, then add that also to Firebase,  and add a corresponding CNAME record provided by the Firebase dashboard in Cloudflare for www, ensuring the proxy status is enabled, and then save your changes.

5. Deploy Cloudflare Worker for Prerender

Click on Workers & Pages 

e76a9cc7-72b6-40d8-9023-b03268e5271e

Click on Create Worker


image-1707393115699

 

Give the worker a name and edit the code.
image-1707393213227

image-1707393235620

Copy the source code from the link below and replace the default code. 

Cloudflare worker source code.

image-1707393283730

Save and deploy the updated worker code.

image-1707393346320

 

6. Configure Worker Triggers and Variables

Step back to the previous interface by clicking on your worker's name on the top left.
image-1707393442913

Click on triggers, then Add route, select the zone your domain is on, and add your domain as *.example.com/* or *example.com/* if you don't use subdomains.

 image-1707393609541

Go to Settings and Add an environment variable named `PRERENDER_TOKEN` in the worker settings with your Prerender token as its value.

image-1707393719707

image-1707393773730

Your Prerender.io Token can be found in the Security and Access menu.image-1718877304392

Click on Save and Deploy
image-1707393853317

7. Test the Integration

Visit your page, change the user agent to Googlebot, and refresh. If you see the Prerender request ID, the integration is successfully working.
Guide for testing