0

Let's say I have myapp.appspot.com and two custom domains respectively called foo.com and bar.com. How do I configure Google App Engine (GAE) such that:

(www.)foo.com -> foo.myapp.appspot.com

(www.)bar.com -> bar.myapp.appspot.com

(www.)foo.com -> myapp.appspot.com (default version)

I'm reading https://developers.google.com/appengine/docs/domain but I still don't understand how to configure it. I get the impression that GAE only supports wildcard for one custom domain e.g. **.foo.com.

Community
  • 1
  • 1
wiradikusuma
  • 1,930
  • 4
  • 28
  • 44

2 Answers2

1

You can route using the dispatch file (dispatch.yaml).

This blog post gave me the necessary info, and I imagine for the case of needing to map multiple domains to different modules would require a dispatch.yaml something like this:

# Dispatch
# ========
---
dispatch:
  - url: 'foo.com/*'
    module: foo
  - url: 'bar.com/*'
    module: bar

Don't forget to add the custom domains as well as SSL certs in the App Engine console.

bakavic
  • 1,297
  • 10
  • 11
  • 1
    this will only work on subdomains and main domain need to be the same. You can route to foo.example.com and bar.example.com but not on foo.com and bar.com – Mahesh Khond Nov 05 '19 at 09:39
0

You can't really do that directly, as you associate your custom domain with an App ID rather than the App URL.

I guess you could map both foo.com and bar.com to your App ID, then in the default version of your App Engine parse the URL, and redirect accordingly, but it's not a great solution as you would be redirecting from your custom domain back to appspot.com domain.

Gwyn Howell
  • 5,365
  • 2
  • 31
  • 48