Understanding DNS requirements for Google App Engine apps
Asked Answered
S

2

11

I have a Google App Engine working, and I have bought a domain. To link the two, I followed the official guide.

Specifically, the guide suggests setting up these DNS rules:

enter image description here

The thing is, I own both the naked domain (site.com) and the www subdomain (www.site.com). Following the guide, I set up the following rules:

Type      Name               Value
A         site.com.          216.239.32.21
A         site.com.          216.239.34.21
A         site.com.          216.239.36.21
A         site.com.          216.239.38.21
(other AAAA for site.com.)
CNAME     www.site.com.      ghs.googlehosted.com

Questions

I think what I did is correct, because it works: I can type both site.com and www.site.com and be directed to my app. But I have some confusion regarding the www subdomain.

  1. What is ghs.googlehosted.com , and why do I need a CNAME on that for the www subdomain? Why no A records for www?

  2. How is the subdomain working? I have no A records for that, just this CNAME, but still it points to my IP.

  3. I don’t understand the guide when it says:

Typically you list the host name along with the canonical name as the address. In our example, one of the records you would add is the host name www with the address ghs.googlehosted.com. (If you use a naked domain, you would use @ as the host name and a corresponding value from the Add new custom domain form.)

Can you explain the meaning of this paragraph? What’s this @?

Shape answered 19/9, 2016 at 15:6 Comment(7)
Care to explain what’s wrong with this question? There are multiple questions, but if you know what ghs.googlehosted.com does, you can immediately answer. If you don’t, well you don’t. I could not find this information with my research, and it has never been asked on SO AFAIK.Shape
This setup can't work unless your site is hosted by Google App Engine or Google Sites(ghs.googlehosted.com). Just tested with my domain registrar and with a local DNS server. How do you check if it points to your server? Using a DNS query or using application layer protocols like HTTP?Sailplane
@Dieter I have an app running on Google App Engine and I am following their guide. I know it works simply because I can connect to both site.com and www.site.com via HTTP.Shape
But then you should know that your subdomain points to the IP-address of the gateway/load balancer(ghs.googlehosted.com) which forwards HTTP requests to your IP-address. This forwarding is not done over DNS.Sailplane
@Dieter yes, but that’s not my question. My question is why I was asked to do different things for site.com (A records pointing to 216.239.3X.21) and for www.site.com (CNAME pointing to ghs which DNS-resolves to 216.58.194.83).Shape
It’s not a problem, it works, I just don’t understand it. The current answer states the two options are equivalent, but 1. it does not look so, IP wise 2. if so, why the guide would be suggesting doing one on the main domain and one on the subdomain? The logical thing would be to point the balancer from site.com and to point at site.com from www.site.com . There’s something I am missing in that part of the guide.Shape
Sorry, I was just a bit confused because you wrote I have no A records for that, just this CNAME, but still it points to my IP. I guess the guide suggests it this way because your server should be reachable over your domain using other protocols like SSH or FTP. Pointing to a gateway will only work for HTTP. That's why they suggest it only for the www subdomain.Sailplane
W
4

The guide is suggesting you to use one of the DNS type either use A and AAAA(IPv6) or CNAME.

1) You can use A & AAAA record for www subdomain. Just make the DNS to

A         www.site.com.          216.239.38.21
(other AAAA for site.com.)

2) The reason why your www subdomain is working because your pointing www.site.com -> ghs.googlehosted.com. See there is www. before your site.com

CNAME     www.site.com.      ghs.googlehosted.com

3) @ is used to denote the current origin. So when you use @ it translates to site.com.

To make things simpler i would just use the following DNS entries. This way my website is accessible by both naked domain and www subdomain.

CNAME     www.site.com.      ghs.googlehosted.com
CNAME     @      ghs.googlehosted.com

If you just want to serve your website via naked domain.

CNAME     www.site.com.      site.com
CNAME     @      ghs.googlehosted.com

Here we point our www subdomain to naked domain.

Warship answered 22/9, 2016 at 17:5 Comment(4)
Thank you. I understand what you say and it makes sense. But then I would expect ghs.googlehosted.com to resolve to these 4 IP addresses. But it points to a completely different address, see here. Am I missing something?Shape
Looking at the guide, it does not seem an alternative to the A records, but rather an additional record to insert.Shape
Check this. This explains the difference between CNAME and A record. webmasters.stackexchange.com/a/60136Warship
Yes, I know the difference, I was saying that ghs.googlehosted.com does not seem to resolve to these IP addresses. So adding these four A records is not equivalent to adding a CNAME record pointing to ghs.googlehosted.com, as stated in your answer. As far as I can tell.Shape
D
3

I've just been through this process, and was also confused by the requirements shown on the screenshot presented by the OP. In 2020 it still looks pretty much the same.

It does seem to imply you need A, AAAA and CNAME (which is makes no sense - A and CNAME are contradictory). My DNS registrar - cloudflare - does not allow you to setup these options together.

To help anyone else searching and finding this page, I noticed on this page of docu the following line:

Record type: Enter the record type that is shown in the DNS record Google created for you (A, or AAAA, or CNAME).

This makes it clear you can just setup one set.

Drayage answered 20/9, 2020 at 19:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.