Google cloud DNS: point naked domain to www?

2019-01-15 11:45发布

问题:

I maintain the owon.ro domain which uses a simple App engine app. I also we use google cloud dns.

These are the dns records:

  1. A record with IP addresses:
    owon.ro. ->
    216.239.32.21
    216.239.34.21
    216.239.36.21
    216.239.38.21

  2. CNAME
    www.owon.ro. -> ghs.googlehosted.com.

And also some MX records.

The problem is that the app is reachable from the www subdomain and the help section states that those IP addresses should be in the A record for the naked domain to redirect to www, but it doesn't work.

I also tried to use @ wildcard for the A record but that doesn't work also.
If you go to owon.ro you will see a 404 page but the www subdomain works.

Am I missing something?

Thank you

回答1:

Found the answer in the end thanks to Dan Cornilescu.

If you use Google Apps you can set up to redirect the naked domain to www.

If not, you will need to follow the steps by going to
Console > App engine > Settings > Custom Domain.

In here, at the second step, you will have to point www to the app (by using the second option) and clicking Add.
And then also point the naked domain to it by choosing the first option and clicking Add again.

So if I understand correctly you will server the app using www subdomain and the naked domain in contrast to redirecting the naked domain to www as in the Google apps case.

In the end, my custom domain tab looked like this.

And my DNS records looked like this



回答2:

The DNS operations suggested in step 5c (documentation here) are not enough, you also need to actually add the naked domain to the GAE config (in addition to the www one) - step 5d.

5. Continue to the next step the Add new custom domain form, selecting the custom domain you want to point to your App Engine app:

    a. Refresh the console domain page so it will list the domains properly.
    b. If you want to use a subdomain, such as www, use the second option (http://www.example.com);
    c. If you want to use a naked domain, use the first option to specify a naked domain (such as http://example.com).
    d. Click Add to create the desired mapping.


回答3:

To link the naked domain so it points to the www when you are NOT using appengine you simply add both the 'A' record and a '@' record pointing to the Google ips which are and look like this:

  A 300 
35.232.62.127

@ A 300 
216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21