If I add a custom domain like *.example.com to my app-engine project, I can then selectively add CNAMEs to that domain pointing to ghs.googlehosted.com to forward subdomains to this project, which will then identify versions in the project.
For example, if my project has a version called www and a version called contact, and I set the CNAMEs for www.example.com and contact.example.com to ghs.googlehosted.com, then www.example.com will be hosted by the www-version of my project and contact.example.com will be hosted by the contact-version of my project.
For completeness: If I don't use the *, but instead add www.example.com and contact.example.com as custom domains to my project, both will be served according to the traffic allocation to the different project versions, whatever they may be.
Now, things get interesting (and that's where my question comes in), if I add *.example.com as a custom domain to one project and dataserver.example.com to a different project. Now, Google App-Engine has to disambiguate whether dataserver.example.com refers to the dataserver version of the first project or to some version on the second project according to that project's traffic allocation.
When I set this up a few months back, it did (what I think is) the most logical thing: It picks the latter, since dataserver.example.com is more specific than *.example.com and should thus take precedence. But when I tried to set up another set of projects yesterday, it instead tried to serve me the dataserver version of the first project (which initially didn't exist, and thus I got 404s, but when I deployed a dummy one, I got that back).
Now the question is: What does App-Engine actually do? Is it random? Is it first-created, first-served? Is it by specificity, but might take a while to propagate to all servers?
Related
A few years ago GAE compelled everyone to migrate their apps from a master-slave datastore to a high-replication one. When that happened, an alias got created. My old project was named "myapp", the domain of the new project became
"myapp-hrd" and the new URL "myapp-hrd.appspot.com" accesses the new project. But the old original URL "myapp.appspot.com" also points to it, thus the old URL is now an alias.
I have created a completely new project with a new version of my app, called "myapp-v2". Is there a way to redirect the existing "myapp.appspot.com" alias from the hrd app to the new v2 one? I could start using the new "myapp-v2.appspot.com" URL instead, but that's ugly, and I prefer to keep the old URL. I thought that there would be an easy way to modify the aliases using the Google Cloud Platform console, but if there is, I'm not finding it.
I could register a new domain, point it at the new one, and start using that, but my preference would be to be able to keep on using the same URL I always have.
Based on this Community Answer, you are going to have to use Google Apps Domain Alias to do that, you will have to follow these steps:
Go to https://www.google.com/a/cpanel/myapp-hrd.appspot.com/DomainSettingsDomains
Remove the "myapp.appspot.com" domain alias of that domain
That being done you freed up your alias from the first project's domain. Now you have to do the following for the second project:
Go to https://www.google.com/a/cpanel/myapp-v2.appspot.com/DomainSettingsDomains
Click Add a domain alias or a domain
Select Add a domain alias of myapp-hrd.appspot.com
Follow instructions to verify your domain (if needed)
Now you have to setup the alias at the App Engine configuration:
Go to your App Engine application dashboard
Go to Application Settings
Click Add Domain
Type the domain name of your primary Google Apps domain (in that case myapp-v2.appspot.com)
Click Add new URL
Select your domain alias from the dropdown list
Click Add
You will be asked to add a CNAME to ghs.google.com in your DNS configuration
I did pore through other similar questions and found answers. I am still having a situation that is not answered and I am not able to comment on those posts to seek clarifications. Thus this new question.
Let me explain my situation...
I have a GCP Project and enabled AppEngine on the same.
I have setup 3 services: 'default', 'api' and 'ui'.
I have deployed apps on all the 3 services and they are all being served through their appspot urls without any issues.
Now I want to setup routing using own domain, purchased from GoDaddy. The schema looks like the following:
www.my-domain.com -> 'default'
rest.app.my-domain.com -> 'api'
ui.app.my-domain.com -> 'ui'
I have the dispatch.yaml to setup the routing rules and I can see the same properly defined in the 'Services' screen. No problems there... The problem is in defining the custom domain mappings for these services.
For the 'default' service, it was easy. GAE identified GoDaddy and requested A & AAAA records for managed security. And then CNAME 'www' pointing to 'ghs.googlehosted.com'. Done and all went well.
Now, for the other services, GAE is asking for the same set of A, AAAA and CNAME records.
Here is the problem. I cannot setup multiple CNAME records pointing to the same value ('ghs.googlehosted.com'). The GoDaddy cPanel/DNS Manager Tool does not even allow adding such records. I have spoken to their support and they confirm that their tool is restricted ti ICAAN policies. So multiple CNAME records is out of question.
As a workaround, I setup a sub-domain pointing to googledomains. I setup 'app' as a new Zone in 'Cloud DNS' in m GCP Project. All name servers are placed in master DNS zone in my GoDaddy. This could allow me to create CNAME record for 'app' in googledomains, atleast theoretically. But GAE Project Settings does not recognise the domain. Its forcing me to make the CNAME records in GoDaddy under the master zone. Not sure how Google doesnt understand the ICAAN policies!! So this option walked into a wall too.
Then I read about the wildcard subdomains. GoDaddy documentation describes the support for this but limited to a specific IP (so only A record). However, GAE needs the value 'ghs.googlehosted.com' and that means I must create a CNAME record only. There are many discussions on this; some saying this will not work and others claiming this works.
This is quite literally my last option and I would like to know how to make this work. If there is any other way to get this setup working, it would save me a lot of time and trouble. I am a developer and all this infra work is just such a hog on my productive bandwidth.
Thanking you in advance.
Finally, the way I have resolved this is to define a single wildcard CNAME in GoDaddy pointing to 'ghs.googlehosted.com' and registered all subdomains as new domain names (actually with different names) in googledomains now. The latter is an alternate fail-safety to ensure my clients can connect. I am now waiting for the current subscription to run out and move away from GoDaddy after. Right now, the pricing I pay GoDaddy is too much compared to Google Domains and for the level of support quality from GoDaddy it is really not justified.
So, I've worked on this for some time and I believe that there is something odd here.
I tried this with a go daddy domain and 2 app engine services. So the steps that I followed are explained next:
1) Go to App engine and on settings/custom domains add the custom domains you'd like to have (with the subdomains in this case)
2) On go daddy you need to go to your domain and admin your DNS records on your domain.
3) Add The Cnames registers with your sub domain pointing to ghs.googlehosted.com
4) deploy your dispatch.yaml
The thing that I don't understand is why you say that is impossible to do the step 3 as it has never caused issues when I tried to do this. Could you specify how are you doing the third step in go daddy?
Additionally, I believe that this same information is better explained on this documentation Is just that I don't get why is it failing on your side.
I am using a Custom Domain for a Google Application project. I have multiple projects and I use the same domain for each, although only one mapping is active at any time. Historically this has been as simple as Verifying the domain on the latest project and then Adding the domain. The domain has then automatically switched to the new project.
I have not used this approach for some months and when I tried it recently I got the messages
www.xxxxx.com is already mapped to a project.
xxxxx.com is already mapped to a project.
Research on StackOverflow suggests the use of the following command
gcloud beta app domain-mappings create xxxxx.com
This does look the right thing to do, unfortunately the response to the command is:
ERROR: (gcloud.beta.app.domain-mappings.create) App [aaaaaa] is the subject of a conflict: Domain 'xxxxx.com' is already mapped to another application. You must delete the existing domain mapping before you can re-map the domain, or you may specify 'DomainOverrideStrategy.OVERRIDE' on the request to force overwrite the existing mapping. Domain 'xxxxx.com' is currently mapped to an application on which you do not have permissions.
I do not want to use the delete approach since there will be a gap in service before the re-map. I would like to use the OVERRIDE option but I cannot work out how to add it to the gcloud command and I cannot locate any documentation.
Update 6Nov17.
In the absence of an answer I have used the delete approach and it worked as expected. The re-map was possible immediately after the mapping was deleted for the current app. Unfortunately for some users access to the web page was not possible, or error messages were returned, for a while. After about 10-15 minutes normal service was resumed. For my web site a gap of 10-15 minutes is manageable. This will not be true for many sites and I anticipate that Google Cloud will tidy up this procedure before it exits Beta.
If for some reason it is not possible to access the current app to delete the mapping then I guess deleting the app's subdomain information at the domain registrar will have the same effect, although it may be difficult to predict when the delete of the associated mapping will happen.
On the plus site the new automatic SSL provision worked flawlessly.
i am a newbie to Google app engine web application.there are two seperate gae web applications in which one application intended for staging and the other application used for live production purpose.we bought a domain for eg: example.com which we point to staging as
www.staging-example.com(it is working fine). what i want to do is that with the same domain name can i make it to point to the live production app like for eg: www.live-example.com. is it possible?.if its possible please tell me how?. your answers will be very appreciable.
thanks in advance
Please be aware that www.staging-example.com and www.live-example.com are two completely different and independent domains apart from the fact that they are both .com domains.
Since app engine does not support naked domain redirection with SSL (staging-example.com, live-example.com would not work with SSL) you have to use subdomains anyway, like staging.example.com and live.example.com.
And yes that is possible and basically the exact same steps for each app. Since you set that up for your staging domain this should be a piece of cake for you. The steps are described in here, but the highlights are:
Create a CNAME record for your subdomain which points to ghs.googlehosted.com
Add the custom domain in your apps project custom domain settings.
Problem I want to solve
I want to be able to send different users to different versions of my Google App Engine application, on a custom domain, with SSL enabled. This needs to be done in a controlled way, i.e., even landing page should be different, and it has to work on multiple units for the user.
Solution I can't get to work
I am trying to setup a custom domain with sub-domains, and want to be able to access different versions of the application. For example, I have myapp.mydomain.com, and I want to run one version (alpha) on alpha.myapp.mydomain.com, and one version (beta) on beta.myapp.mydomain.com (where alpha is default).
I use the Google Developers Console to set up custom domains, using myapp.mydomain.com, and *.myapp.mydomain.com as custom domains.
This works perfectly as long as I don't try to add on SSL as well, i.e., beta.myapp.mydomain.com serves the version named beta. When I set up SSL I start by adding my application to Google Apps, (per https://developers.google.com/appengine/docs/ssl) and then set up my domain to point to my app. First I add myapp.mydomain.com, then alpha.myapp.mydomain.com, and last beta.myapp.mydomain.com.
When that is done beta.myapp.mydomain.com start to serve the default version instead. Except that it sometimes also serves the beta version (this happens one in every 20 tries or so, I assume it's a glitch for now).
My questions:
a) Should I set up my domains in both Google Apps and Google Developer Console? Or should I remove the setup from Google Developer Console? I tried both, seems to give the same results.
b) It seems like it is possible to get it done by using modules as indicated in
Google App Engine custom domains, subdomains and SSL and in Appengine modules dispatch.xml routing with custom domain. Is this the only way, or am I doing something wrong in my setup?
Suggestions I have received so far
One suggestion is to use traffic splitting and set a unique cookie depending on what version I want the user to end up with. I did not know about this, and it will solve some other issues I have been looking at. It does not solve my current problem though, as I need to have this set before log in. The answer is useful though.
I'll answer with what I did to make this work for me.
Instead of sending users to different versions of the app, I created a new module called alpha, and directed users using alpha.myapp.mydomain.com to that module using dispatch.xml.
<dispatch>
<url>*alpha.myapp.mydomain.com/*</url>
<module>alpha</module>
</dispatch>
I set up custom domains in the App Engine Console (https://console.developers.google.com) under Compute->App Engine->Custom Domains, for *.myapp.mydomain.com and alpha.myapp.mydomain.com. I also added the URL alpha.myapp.mydomain.com to the accepted URLs for my App Engine app on Google Apps (https://admin.google.com). This allowed me to run over SSL as well.
I intend to run the app under another domain (domain alias to my primary domain), so I tried that as well. To make this work I ONLY added the domain alias in Google Apps as www.mydomainalias.com and alpha.mydomainalias.com, because if I added it to Google App Engine custom domains I got an error message ("We are unable to process your request at this time. Please try again later. (Error #1000)"). I have no idea why it that did not work out.
The easier approach is to do traffic splitting on a cookie level compared to setting up extra subdomains AND extra SSL certificates.
The domain name to access your alpha version does not have to change using this approach.
from the docs :
The response from your app does not already contain a Set-Cookie:
GOOGAPPUID=... header. This allows your app to control which version a
user gets.