Mapping to a domain name (either the default appspot.com
one or a custom one) is done at the application level, not at the service level. Your both services, being part of the same app, would thus be mapped to the same domain.
Side note here: I assume you chose different service/module names for your services (in the respective .yaml
files), otherwise they overwrite each-other at deployment time.
Routing a request to one service or another is done based on pattern matching on the filepath portion in the URL, not on the host/domain portion. First match wins and no match always goes to the default service.
Because of this typically the frontent is the default
service (you can also leave it unnamed). An any other, more dedicated service, have an identifying pattern in their URL path which is used for routing with a dispatch.yaml
file. In your case, for example, the backend service would be the specialized one and could serve, let's say, URLs starting with /backend/
, thus could have a dispatch.file
like this:
dispatch:
- url: "*/backend/*"
module: <backend-service-name>
More or less related:
Note: You have to account for the specific pattern inside the specialized services as well. If, for example, your backend service currently serves a request for /index.html
you'll have to adjust it to serve /backend/index.html
instead.
It might be possible to make both services work side by side without a dispatch file, using other routing methods (see the entire How Requests are Routed section), but IMHO it's more difficult to set up and more fragile. Especially when trying to also use custom domains.