Firebase hosting with Cloudflare proxy vs. DNS only

I’ve pointed my DNS to Firebase for a website hosted there. It’s a single page app with a pretty huge bundle.js and I’d like to take advantage of Cloudflare caching.

However, when I set the DNS to “Proxied”, Firefox tells me “The page isn’t redirecting properly.” With DNS set to DNS only, it works again but I’m paying more for each download (I think…)

I haven’t seen this topic discussed, so I assume I am doing something wrong.

Could you proxy the record and send the link so we can take a look?

Sorry, it’s not a public website. I can open a ticket with Cloudflare or send some console logs, screenshot, etc?

To troubleshoot this, I do a series of curl -I https:/ commands, then watch the 301/302 header for Location, and then curl that one. Lather, rinse, repeat until you see the pattern that’s looping. The most frequent cause is an insecure server that’s using HTTP while Cloudflare is set for HTTPS, and it just loops between HTTP and HTTPS.

I can confirm Firebase hosting works with Cloudflare Proxy :orange:, but …

Just to add a note here, depending on how the OP has setup the Firebase hosting “by default”, as far as I remember, he could add only non-www, or both www and non-www version of the domain.

Therefore, when the user adds the naked domain (non-www) to Firebase, Firebase “somehow” figures out and suggest the user adding the www too.
If the user adds the www too, therefore Firebase is asking for the confirmation with the dialog pop-up “should we redirect non-www to www?” as far as I remember.

Nevertheless, when using :orange: proxied records, at Firebase dashboard you would always see the notice “Needs setup” (above screenshot) - you can safely ignore it as long as if you have successfully setup the DNS records at Cloudflare (below screenshot as an example).

Also if I may add a note here, SSL settings at Cloudflare should be set to Full - while testing, the Flexible (even not recommended) and Full (Strict) are not working - at least not working as it throws the SSL or redirection error (not sure why exactly) for my three domains using Firebase hosting.

  • I have also added the Google’s recommended CAA records due to the Let’s Encrypt SSL certificate renewing … and certificate is new and valid from Google Firebase (LE)

Regarding the redirect, there is a way to setup the rewrites for the source and destination (accepts the wildcard symbol too ** ) in the firebase.json file, in case if needed.

Hope it helps a bit to clearify and figure out something out of it :face_with_raised_eyebrow: :thinking:

I will give it a try again, maybe I should try to troubleshoot it again as hopefully something changed and could work with Full (Strict) - 2 years passed since then (just in case).

Wow, lots of good info here! Thanks to all for your insights.

Setting SSL to Full was all we needed. Previously, it had been set to Flexible…

Thanks, @sdayman. Firebase hosting is all HTTPS of course, and Firebase is probably competitive with Cloudflare in terms of protection - I’m not overly worried about anyone discovering my backend IP with Firebase. I don’t know how successful a DDOS attack would be against Google’s infrastructure. But I suspect that Cloudflare caching will make a difference in my monthly expenditure!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.