63

I am trying to set custom domain for my Firebase app.

Firebase hosted url : https://inventory-app-726af.firebaseapp.com/

Custom Domain: inv.agsft.com

I have followed all instructions as part of setting custom domain but after verification step when I click on finish button, status will always be "Needs Setup".

I am managing DNS through cloudflare (https://www.cloudflare.com/) and I am following Quick setup option.

Any pointers to resolve it?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Pari
  • 1,443
  • 3
  • 19
  • 34
  • 2
    When I run `dig -t txt +noall +answer inv.agsft.com` there are no `TXT` records showing. Since those are required to verify your ownership of the domain, Firebase Hosting will not continue the setup beyond step one. Aside from that: there's not enough information here for anyone on Stack Overflow to help. If you want personalized help, [reach out to Firebase support](https://firebase.google.com/support/contact/troubleshooting/). – Frank van Puffelen Aug 01 '17 at 13:50
  • 1
    Thanks. I have corrected TXT record. dig -t txt +noall +answer inv.agsft.com inv.agsft.com. 299 IN TXT "google-site-verification=8uObmfAMZrc29piBvbJnRmyKNhONB3Iom6-qMOT9gHk" – Pari Aug 02 '17 at 04:29
  • I am trying Advance Setup option, need to wait for 24 hr and I will update details. – Pari Aug 02 '17 at 04:41
  • 1
    It seems there is something else, I have contacted firebase support and I have not yet received resolution. I will update post with answer after resolution. – Pari Aug 02 '17 at 12:21
  • 1
    What's the update Pari? – damingzi Jul 07 '20 at 05:16

12 Answers12

58

I had the same problem, I was able to resolve it by toggling the DNS Status on cloudflare from DNS and HTTP Proxy (CDN) to just DNS on the two A records

enter image description here

It started working right away.

starball
  • 20,030
  • 7
  • 43
  • 238
brennen
  • 758
  • 5
  • 7
  • In this happens to me, how exactly did you do that using Cloudflare's current site? – Murray Rowan Sep 14 '17 at 20:56
  • 1
    @MurraySmith you just click on the cloud on the far right of the row next to each DNS record. So make sure the two A records for your firebase URL is toggled aka it'll show a Grey Cloud. – brennen Nov 01 '17 at 23:03
  • So, this disables cloudflare, how I will use it? – Teoman shipahi Mar 28 '18 at 02:38
  • 2
    I just tried it and this still works! You only need to do this for the two `firebase1._domainkey` and `firebase2._domainkey` CNAME entries. Which are used to verify your domain ownership. Don't do this for your `www` A records or something similar of course. – Maarten Docter Nov 29 '18 at 21:40
  • You just need to turn off Cloudflare to prove the ownership of the domain! After it is approved, you can turn it back on! Firebase doesn't see the record you added, if you turn Cloudflare on, as that is the whole purpose of the cloudflare to hide your destination address – eddyP23 Feb 15 '19 at 08:09
  • 2
    And it is arguable, whether you need Cloudflare at all on top of Firebase hosting – eddyP23 Feb 15 '19 at 08:10
  • Thank you, I spent about 30 minutes to understand why it's not working. And you saved me! – Josh Dec 03 '19 at 11:26
  • Worked first time for me – Donovan May 20 '21 at 15:32
  • Saved my day and since there is a 15 character min length , you have a good day . – 32teeths Nov 21 '22 at 13:04
27

The proper solution, ie without disabling Cloudflare for the site, is to use Full SSL for your domain/subdomain.

You can either choose Full SSL for all your domain entries, or set up a Page Rule for a specific subdomain, in your case, use "inv.agsft.com/*"

Source: https://community.cloudflare.com/t/flexible-ssl-redirect-loop-with-google-firebase/2063/3, which in turn points to https://support.cloudflare.com/hc/en-us/articles/115000219871-Why-does-Flexible-SSL-cause-a-redirect-loop-

Had the same issue and this solved the redirect issue. Firebase will however still report the domain as "Needs setup", for that I have no solution, but it does not affect the functionality of the hosting.

Motin
  • 4,853
  • 4
  • 44
  • 51
  • 1
    just changed the option from `Full (Strict)` to `Full` which is more logical if firebase is already providing the SSL certificate – Kardon63 Dec 07 '22 at 08:17
20

For the people that is using Namecheap, This configuration worked for me.

Namecheap configuration

coyr
  • 659
  • 6
  • 9
9

To avoid any kind of ssl issues when using firebase hosting and cloudflare you have to check to following points:

  1. You don't need to toggling the DNS Status on cloudflare from DNS and HTTP Proxy (CDN) to just DNS on the two A records unless you don't want the cloudflare ssl certificates and want to just use the firebase ssl certificates (look to this carefully because you will loose the protection that cloudflare provides to your site in case you decide to use only the clouflare DNS)

enter image description here

If you "keep the cloud orange" it will not causes any problem to your firebase hosting.

  1. Add the firebase IP's to cloudflare following the instructions provided by firebase hosting and remove any other A record from your domain/subdomain that you are setting up

  2. To ensure you have a end-to-end encryption (using both firebase ssl as well as cloudflare ssl), make sure that your cloudflare crypto options is set to "Full":

enter image description here

  1. Use a page rule likes in case that you want your root domain to receive all trafic:

enter image description here

  1. In your firebase hosting setup, do the same: enter image description here

p.s: Look that the message "Needs setup" is still there but the app is running without any problem.

p.s2: the majority problems regarding cloudflare and firebase is that firebase ssl can take several hours to start to work and you keep seeing a message like "your connection is not private". It happens not beucase cloudflare is messing our proxy out but because firebase ssl is still not fully propagated.

I hope it help others :)

lucianokrebs
  • 831
  • 1
  • 12
  • 15
4

In my case I did the same that Brennen did:

  • toggling the DNS Status on cloudflare from DNS and HTTP Proxy (CDN) to just DNS on the two A records.

But just start working when I:

  • Delete the domain from firebase. (click on the : points select delete domain)
  • refresh the firebase site
  • Added again in Quick Setup. I already had the A record added in Cloudflare so I didn't added again.

After that automatically the status added was connected.

Remember: Before testing, clean your browser cache.

3

When I run dig -t txt +noall +answer inv.agsft.com there are no TXT records showing. Since those are required to verify your ownership of the domain, Firebase Hosting will not continue the setup beyond step one.

Update: since the next step requires you to map A records to the IP addresses of Firebase hosting, I ran the relevant dig too:

$ dig -t a +noall +answer inv.agsft.com
inv.agsft.com.      299 IN  A   104.18.56.240
inv.agsft.com.      299 IN  A   104.18.57.240

Those are not the addresses I'd expect for Firebase Hosting, so it looks like either you haven't correctly entered the A records, or they have't propagated yet.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • I just ran the dig command and got below result. dig -t txt +noall +answer inv.agsft.com inv.agsft.com. 299 IN TXT "google-site-verification=8uObmfAMZrc29piBvbJnRmyKNhONB3Iom6-qMOT9gHk" – Pari Aug 02 '17 at 14:05
  • Good. But the reason you had the problem you reported above was because the `TXT` records are missing. With that problem fixed, Firebase Hosting should be able to verify that you own the domain (may take up to 24 hours) and then transition to the next phase (adding A records iirc). – Frank van Puffelen Aug 02 '17 at 15:16
  • I added some info on what I now see. But since you also filed a support case, I'd recommend updating there, since they can see directly in the support systems what the status is. – Frank van Puffelen Aug 02 '17 at 15:23
3

When I change my setting like below, it started to work again. Redirect loop fixed:

enter image description here

Teoman shipahi
  • 47,454
  • 15
  • 134
  • 158
3

For GoDaddy this adding the following solved it for me:

TYPE:A

NAME:@

VALUE: your ip_1

TYPE:A

NAME:@

VALUE: your ip_2

George
  • 169
  • 2
  • 14
2

June 2020

Just wanted to share what was successful for me. It was a combination Brennen and Lisbel's answer.

Step 1: Toggle off your DNS status to get a grey cloud (as shown in the earlier answer)

Step 2: Delete the domain from firebase

Step 3: Add it back with Quick Steup

It should be connected after these steps!

Max
  • 834
  • 8
  • 19
  • Did you delete the domain AND redirect domains (http->https) of your website doing this? I have essentially four domains. – NFL Sep 24 '20 at 05:44
  • Also when re-added the domains, did you toggle the orange cloud proxy setting on cloudflare or let it be gray? – NFL Sep 24 '20 at 05:47
0

I had the same issue. Here's how I fixed it:

1) Cick the View button on the problematic domain (in the Hosting section next to where it says Needs Setup).

2) Change the 'Setup mode' from Quick Setup to Advanced and follow the 3 steps

  • 2a) Open your domain provider's settings (I'm using Google Domains) and add the TXT record it's giving you.
  • 2b) Wait about 4-12 hours for verification
  • 2c) Add the provided A records into your domain provider's settings

This is not a quick process, but it should be working about 5 minutes after you complete step 2c.

FiringBlanks
  • 1,998
  • 4
  • 32
  • 48
0

Toggling DNS mode didn't work for me. So I tried following approach and it worked for me.

  1. Add CNAME record pointing to {firebase-project}.firebaseapp.com or {firebase-project}.web.app, you could add A record and try.
  2. ADD TXT record as firebase ask you
  3. Verify from firebase (this will show as needs setup, also it didn't go away although this worked)
  4. If new domain/subdomain doesn't works check your browser developer tools network tab. If there are lots of 301 happening then go to cloudflare page rules. Add newdomain.com/* or subdomain.newdomain.com/* then add settings select SSL and set it to full as follows.

enter image description here

Then it will work as expected.

Ruwanka De Silva
  • 3,555
  • 6
  • 35
  • 51
0

Working as of 11st May 2022 without need to toggle DNS and HTTP Proxy (CDN).

Steps:

  1. Go to Cloudflare Dashboard.
  2. Select SSL/TLS.
  3. Select Overview. Cloudflare SSL/TLS Overview
  4. Select Full option for SSL/TLS encryption mode.enter image description here
  5. After that, refresh your website that previously have issue to access.
  6. Now the website can access successfully.
Jerry Chong
  • 7,954
  • 4
  • 45
  • 40