I was looking at https://material-ui-next.com
who seem to be running on firebase hosting and use CloudFlare on top of it.
This raised a question. Do firebase hosting websites need additional layers for things like DDoS protection? As as I am aware, firebase provides SSL, CDN, DDoS and caching out of the box? When would one want to add CloudFlare on top of that?
By having a CDN like Cloudflare in front of Firebase, you'll rarely hit your Firebase hosting server, thus reducing your potential charges. And going back to Security & Protection, if a bad actor does a DDoS attack, you'll stop them at Cloudflare and not start racking up charges.
While it may have a few cons as described above, this service is still a great option and even a cheaper than MaxCDN. Overall, CloudFlare is worth trying if you need to optimize page load times on a content delivery network that does not comprise your website's security or cost you a fortune. Try CloudFlare.
Firebase Hosting uses a powerful global CDN to make your site as fast as possible. Any requested static content is automatically cached on the CDN. If you redeploy your site's content, Firebase Hosting automatically clears all your cached static content across the CDN until the next request.
Setting up Firebase hosting to use Cloudflare is pretty simple. Go to Cloudflare and add your website. You'll need to update your domain registrar to point to Cloudflare so the DNS entries can be managed. In the Firebase console go to Hosting and click the “Add Custom Domain” button.
UPDATE: I've moved from Firebase hosting to Netlify
While deploying our website (https://mfy.im) we ran into a similar debate. However, we decided to go with Firebase hosting without CloudFlare
The main reason is the performance:
Using Firebase config json I was able to configure most of the things that I did earlier in CloudFlare.
However, if you're not much concerned about performance, I recommend to use Firebase with CloudFlare due to the following reasons:
To anyone looking to put Cloudflare or another CDN in front of Firebase - bear in mind that Firebase sees only one IP making a massive number of requests and may decide to block that IP. I'm not sure if this is something happening recently, but here's the (arrogant) response from Google Support on the matter:
The specialist we involved in the issue recommended us to escalate this with one of the Firebase Engineers which we did.
The engineers mentioned us that CloudFlare integration is limited as Firebase hosting already provides content through the Firebase CDN[1] and adding a second CDN on top is discouraged as it can actually bring down the site performance.
This causing a limitation preventing us to allow the cloudflare IPs.
Edit: If you're interested in doing this, Google have opened a "Feature request" here to whitelist / stop blocking CDN IPs:
https://issuetracker.google.com/issues/185590945?pli=1
Please star it if you would like it resolved faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With