Google cloud DNS: point naked domain to www? - google-app-engine

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:
A record with IP addresses:
owon.ro. ->
216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21
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

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

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.

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

Related

Get custom domain name to work with app engine instance?

I have a domain name purchased via google domains. I want to point it to my app engine instance. In the "custom domains" settings tab in the app engine console, I have the following:
I want both the "bare" and "www" flavors to point to my app engine instance:
http://example.com
http://www.example.com
I'm not sure which option to use for step #2 to get that to work?
Thanks
You'd be following the Adding a custom domain for your application procedure, with focus on section 4:
4. 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.
You need to specifically add both the naked domain and the www subdomain, explicitly, by running the entire section 4 twice, once selecting 4c and once selecting 4b, respectively.
To do that at step #2 (in the Add a custom domain screen illustrated in your image) you first select the 1st radiobutton, for http://example.com and click Add. Unfortunately you don't see this addition displayed anywhere in the developer console (AFAIK). When the custom domain config was done through Google Apps the naked domain was visible explicitly, but that's no longer available.
Then come back at the Add a custom domain screen and at step #2 select the 2nd radiobutton, fill in www in the text input area (if needed), select example.com from the dropdown list (if needed) and click Add. This adddition should cause a new entry to be listed in the Custom Domain main screen (the parent screen), with a www.example.com Custom domain name and a www Alias.
This should be all (it may take a while for the DNS changes to propagate to your machine so that you can verify the effects, the doc mentions up to 24h).

Does GAE support me having unlimited subdomains?

If I want to run my service on google app engine (python), do they all me to create my own custom subdomains easily and without any limit?
For example, my service will run on my custom domain:
www.example.com
For each customer I will create their own custom domain like:
customer1.example.com
I may have 1000's of customers, so this would have to be easily done using an API call or they allow wildcards.
My application will analyze the subdomain and lookup the customer.
This will be a single application that will handle all subdomains.
Sure, have the wildcard (*) CNAME record of your domain (i.e. *.example.com) point to ghs.googlehosted.com in your DNS panel and all requests to any subdomain of your main domain will go to your app (and make sure this is also reflected on the GAE's Custom Domains Settings Page as shown on the screenshot below):
Then have one of your first webapp2 routes as something similar to:
# match all subdomains BUT www
DomainRoute(r'<:(?!www\.)[^.]+>.example.com', [
Route('/', handler=CustomSubDomainHandler)
])
which will match requests to any subdomains but the www one (since you might want to serve your actual app via that one).
And your CustomSubDomainHandler could look simmilar to:
class CustomSubDomainHandler(webapp2.RequestHandler):
def get(self):
subdomain = self.request.host.split('.')[0]
# code to look up the customer by analyzing the `subdomain` goes here...

Google app engine own domain

Im having trouble with Google App Engine and using my own domain. I have a domain that i'm also using in Google Apps for Work.
I have connected my GAE project in Google Apps so they are linked.
I have added my custom domain in GAE, verified ownership and it seems to be correct.
Here is a picture of the GAE settings.
And on Google Apps for work.
The other setting I know I have to do is on my domain registrar. I have added the records from GAE, from the picture I uploaded.
Im using one.com as a domain registrar and my DNS settings look like this:
Am I doing something wrong that you can see directly like "Hey what's this guy doing lol" or does it seem correct at first sight?
Thankful for any help in the right direction.
#
EDIT:
After following the tip from comment, I have verified and mapped the domain "lkpgpremiumcars.com". And added "beta" as subdomain. My "Custom domains" looks the same (like below):
I also removed A and AAAA-records and added a CNAME.
Waiting for DNS update to see if it works.
EDIT 2:
Still dont work.
BTW is it normal behavior that if I select the same subdomain again it says this:
Or is is just because it already points to this app?
You'll need to add this as a sub-domain.
First remove the custom domain (beta.lkpgpremiumcars.com) from the developers console.
Remove the A and AAAA records that you've added to the DNS.
Follow the instructions here and on step 1, only add the domain 'lkpgpremiumcars.com' and verify. This doesn't mean you're pointing the naked domain to your application.
Once it's verified, refresh the page and now you should have the domain available on step 2.
Select the second option on step 2, put 'beta' on the text box and select the previously added domain from the drop down beside. Click Add.
Go back to your DNS settings and add a CNAME record for 'beta' pointing to 'ghs.googlehosted.com.
Allow some time for propagation and it should work!

Setting up custom domain with www on appengine

I've set up a custom domain with Appengine.
The domain currently works as http://example.com (naked domain) but it throws a "This webpage is not available" error with http://www.example.com
Any idea how could I get the 'www' subdomain working? Would it be possible to fix it by adding/changing the DNS records (CNAME, TXT)?
The procedure is as follows:
Navigate to
https://console.developers.google.com/project/yourapp/appengine/settings/domains,
having replaced "yourapp" with your project name.
Click "Add custom Domain"
Go to the 2nd section (it will say "Select the domain you want to point to yourapp").
In that section, select the 2nd field, fill in "www" and select the domain in the dropdown.
Log in to your DNS management dashboard (this could be godaddy.com, namecheap.com, etc).
Add a CNAME record with your DNS host, as follows: alias: "www", address (canonical name): ghs.googlehosted.com, and save.
Give it a few minutes, and www.yoursite.com should now take you to your app (should be the same that can be found at yourapp.appspot.com).
Assumptions I made:
That you wish to point the DNS record to the default module of your AppEngine project. Please leave a comment if you wish 'www' to point to a different module.
That you have already registered your domain with Google and have a TXT DNS record there, proving your ownership of the domain to Google.

Subdomain to AppEngine Application w/ CloudFare

I'm using cloudfare, and I have the record below:
Type Name Value TTL Active
A mysubdomain to my webhost IP Automatic not
In cpanel, I have:
mysubdomain.example.com. CNAME ghs.google.com
The problem is that when I try to access my subdomain in browser, I was redirected to /cgi-sys/defaultwebpage.cgi
What's wrong w/ my configuration?
It looks like you have an A record and a CNAME record for the same name pointing at different things. This doesn't make any sense.
You don't want to point to an A record to your IP for the subdomain if you're actually using Google for that subdomain (how I'm reading this). It would generally look like this, if you are:
CNAME subdomain name is an alias of ghs.google.com

Resources