Confused about API Gateway and custom domains

Serverless docs currently contain this statement:

Currently, every service will create a separate REST API on AWS API Gateway. Due to a limitation with AWS API Gateway, you can only have a custom domain per one REST API. If you plan on making a large REST API, please make note of this limitation. Also, a fix is in the works and is a top priority.

Does this mean that we can’t define multiple base path mappings for a custom domain to different APIs? I can’t see that this is an APIGW limitation as the APIGW UI certainly allows me to create multiple base path mappings pointing to different APIs.

Related question:
http://forum.serverless.com/t/api-gateway-same-base-urls-for-my-apis/674

I hope someone could give some advice on this :slight_smile:

What i did in my project is that i have created multiple services like one service for users and one for chat.

then in custom domain i map example.com with base path of ‘users’ to users service and with base path of ‘chat’ to chat server.

what I’ve found so far is that I can define multiple base path mappings for a specific customer domain. eg, if I have a custom domain of dev-services.lawpath.com I can map multiple base paths and end up with things like https://dev-services.lawpath.com/users and https://dev-services.lawpath.com/applications etc.

The only problem is that I have to define the base path’s manually although I have to admit that I haven’t spent much time trying to work out how to do it from my serverless.yml.

Nevertheless, I do currently have multiple APIs mapped to different base paths on my custom domain.

1 Like