Using custom domain to Google App Engine with custom routing

Adding custom domain to Google App Engine is pretty straight-forward and easy to implement.

But there are some complexities around it when you want to point your custom domain or sub-domain to any specific service or module in Google App Engine. In your Google Cloud project you can have multiple App Engine service. By default your first app engine app will be considered as “default” service. Rest of the apps must need to be on another service or module. So the main use case scenario is, suppose you have a sub-domain “” and you want to point that in your App Engine’s “office-api” service.

Then you can’t do that because if you point your “” to Google App Engine then you can’t use that domain for your other purposes. Google will use that domain to point all services, default, custom, etc..

But if you want to use your primary business domain inside App Engine like your domain then what you will do. You have hosted your website in this domain in another server, you have another services hosted on that domain. But for better personalized sub-domain you want to use that same doamain’s sub-domain in Google App Engine.

Here is the steps about how you can configure your sub-domain directly pointed to any specific service.

You need to add your custom domain to Google App Engine from App Engine -> Settings -> Custom Domain.


Now you need to add your custom domain and need to verify your domain name. Google has a very easy way with instruction to do that. Now from your domain registrar, you need to just change your CNAME pointed to domain. Only CNAME, cause you are using this domain for your other services. Only this specific sub-domain will be used in Google App Engine.

After doing that you are done! Now google has it’s own routing policy to route your application based on but you want to customized that in your way. And you can do that by command line python tools. You can learn that directly from¬†¬†. Now in your dispatch file write the following configuration.

  - url: "*"
    module: office-api

And upload this dispatch file with the command line utilities. Documentations are available Now you have your official homepage hosted on and is pointed to Google App Engine custom services. Now browse your url and you will see your application. Thanks.