Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does firebase hosting benefit from CloudFlare?

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?

like image 813
Ilja Avatar asked Nov 21 '17 09:11

Ilja


People also ask

Should I use Cloudflare with Firebase?

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.

Is Cloudflare good for hosting?

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.

Does Firebase use CDN?

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.

How do I put Cloudflare in front of Firebase?

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.


2 Answers

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:

  • Firebase hosting without CloudFlare: 732ms
  • Firebase hosting with CloudFlare: 1.2s

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:

  • Firebase provides some basic DDOS prevention, but no rate limiting. See: Rate Limiting on Firebase Hosting
  • Brotli compression - Firebase only provides gzip
  • Pricing - only 10GB bandwidth is free. After that, it's $0.15 per GB. If you enable CloudFlare on top of Firebase it will cover most of your bandwidth
like image 52
Gijo Varghese Avatar answered Oct 14 '22 20:10

Gijo Varghese


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.

like image 41
David Avatar answered Oct 14 '22 19:10

David