- Print
- DarkLight
- PDF
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:
You can find the integration's source code on this link.
Text guide:
Access the DNS menu in Cloudflare to find the necessary name servers.
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.
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.
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.
Click on Workers & Pages
Click on Create Worker
Give the worker a name and edit the code.
Copy the source code from the link below and replace the default code.
Cloudflare worker source code.
Save and deploy the updated worker code.
Step back to the previous interface by clicking on your worker's name on the top left.
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.
Go to Settings and Add an environment variable named `PRERENDER_TOKEN` in the worker settings with your Prerender token as its value.
Your Prerender.io Token can be found in the Security and Access menu.
Click on Save and Deploy
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