I'm having a problem with a custom domain for a static web that I'm hosting in Firebase. When I go to mydomain.com it works fine but when I go to www.mydomain.com it's not working. Firebase hosting has an option to redirect to mydomain.com if you are trying to go to www.mydomain.com but it seems I haven't been able to verify that I own www.mydomain.com.
I verified mydomain.com using A records but when I try to verify www.mydomain.com it tells me that I should use exactly the same records I used to verify mydomain.com, so I tried to add the same A records twice but it did not work. After that I tried using TXT records to verify www.mydomain.com but it didn't work either. So, what am I doing wrong?? These are the screenshot of Firebase hosting and NameCheap.
NameCheap
the first 2 A records are to verify mydomain.com, the acme-challenge txt record is the one I'm using to trying to verify www.mydomain.com
Thanks for your help!
The directions given by Firebase are wrong. The host value should be www and not www.mydomain.com when redirecting from mydomain.com to www.mydomain.com. It happens the same when trying to verify mydomain.com but instead of www it should be # like in one of the screenshot of my answer.
Related
I'm hosting a website with Firebase. I was able to verify my custom domain without any issues. However, I noticed that when visiting the site with 'www' I was getting either a 404 error or an insecure warning.
When I try to add the domain with www to Firebase I'm not able to get if verified. I noticed the site verification string for adding the new domain (with www) is the same as the one I had to add to connect the original domain (without www).
I also tried adding a CNAME record with host www and value of piccy.app. Finally I tried to copy the existing A record and change the host from # to www.
What am I doing wrong here?
This is the message I'm getting in the console:
Here's the Namecheap setup:
Any help is appreciated.
I have a wildcard domain. What I want are:
When user go to mydomain.com, it should be redirect to www.mydomain.com
When user go to subdomain.mydomain.com, keep the connect
When user go to www.subdomain.mydomain.com, it should be redirect to subdomain.mydomain.com
What I can do on domain configs (change the record types) or my web server (I'm using nginx)? I searching the questions but not solve my case. Thanks.
you can use dns configuration to achieve this.
something like this
https://help.instapage.com/hc/en-us/articles/206028427-How-do-I-create-a-301-redirect-for-a-root-naked-domain-in-my-GoDaddy-account-
I have to do a 301 redirect from a domain with NO www to the one with www like:
example.com -> 301 -> www.example.com (same domain)
I've bee looking to this example in the official doumentation, but it seems like the configuration doesn't considerate the whole URL path, is there any way to accomplish this?
I'm thinking about creating a separate project for the domain without www and create a firebase cloud function that takes all requests and do a redirect from there
is that the way to go? any simpler solution?
You can redirect out f the box in firebase an option I haven't noticed you just go to the following options:
Hosting
Connect domain
You can write your domain like "example.com" without www
Select the Redirect check button
Write your redirect destination, in my case, is the same domain with www
That's it!
A more specific solution for Firebase (and registrar-agnostic) was provided by Jack himself.
This is usually accomplished at the domain registrar level rather than at the app level. If your domain is with Google Domains, these would be the steps.
Edit:
Since you have your domain in GoDaddy, I would suggest to follow the instructions on their help center.
I added CNAME for my.example.com and it works well, problem is with www.my.example.com.
I tried to create another CNAME record for www.my.example.com pointing to firebase, but there is SSL Certification Warning.
How can I redirect www subdomain to non www? Thanks.
According to Firebase hosting docs what you're trying to do won't work.
Subdomain depth: Subdomains of up to one level of depth are supported.
Deeper subdomains, like my.app.example.com, are not allowed.
You could potentially do the redirect through another provider. Some DNS providers for example will do redirects for subdomains.
I’m having a lot of trouble configuring my custom domain. Currently, if you go to my site www.mydomain.com it redirects to the default somecrazyname.firebase.com. In my google domains, I just have both www.mydomain.com and mydomain.com redirecting to the mycrazyname.firebase.com just for the sake of having something live until I can figure this out. My question is, how do I make it so when you go to www.mydomain.com it stays on www.mydomain.com while showing my amazing content and not somecrazyname.firebase.com.
Everything is configured correctly with firebase as far as my custom url goes(verification, etc.). However, the url firebase gave me is https mydomain.com (where if you go there it says the site can't be displayed) where my domain on Google domains is http. I've tried to configure redirects within my firebase json as well as my synthetic records in Google domains, but have had no such luck and am out of ideas. I've also looked at the firebase hosting custom domains documentation and am just not getting it.
Here are some visuals....
My redirects as seen on Google domains
I'm sure it's just a matter of putting things in the right places, but I have been trying this for a few hours and have not had any luck.
It was the synthetic records that was causing the issue for me. I was using CName records which, by the direction of the firebase support team is good only for subdomain redirects. Below is part of an email from the firebase support team. This is her answer to this as well as some helpful explanations.
Firebase uses TXT records for the verification of your custom domain.
On the other hand, CNAME and/or A records are used for redirection. Please take note of the following:
If you have a subdomain, CNAME records are recommended
Note that the host name with "*" indicates a wildcard. Any subdomains typed before your custom domain will redirect you to your
hosted custom domain.
Otherwise, if you have a custom domain without a subdomain, A records are recommended.
Note that adding both A records will increase redirection performance
Also, kindly remove other A records that are not from Firebase to prevent redirection issues
That's about it. Firebase Static Hosting only needs three records
(TXT, CNAME, A). Other than that, you wouldn't have the need to
implement domain forwarding such as your Synthetic records. Moving
forward though, I would suggest you to remove your Synthetic records
and add the A records I have provided on my previous email.
You should NOT be using a redirect (301 or 302) record for your domain. Instead, you should set a CNAME record. Here's how to fix it:
Delete the second redirect in your screenshot (the one that redirects to Firebase).
Go to the DNS tab of your Google Domains control panel, scroll down to the Custom resource records section, and add a record that looks like this:
www | CNAME | _____ | portfolio-6f15b.firebaseapp.com