3

I have some services registered at API Gateway with Lambda serverless deployment. Both services are running well with long domain named from AWS API Gateway itself. Then, I am trying to setup a custom domain to gathered all services into one domain and splitting services by path.

Here is the example I wanted to do (2 Services example):

1. User Service registered on user-api-service Gateway API

2. Order Service registered on order-api-service Gateway API

I want to add custom domain with these settings:

1. api.myapp.com/user path with destination user-api-service Gateway
    API
2. api.myapp.com/order path with destination order-api-service Gateway
    API

I have tried to set this up but it is not work. And this is the problem:

THE PATH ALWAYS USING ROOT !

Whatever I did, It is never use the defined path. And only the first registered mapping is working !

Based on my setting:

api.myapp.com/user/register should be called for register, but it's not work. It is said 404 or Not Found

But it is working with root path:

api.myapp.com/register

Any custom setup that the documentation of API Gateway is not telling ?

What should I do with this error ?

Adityo Setyonugroho
  • 877
  • 1
  • 11
  • 29

1 Answers1

0

I am assuming you have created your custom domain and attached it to API gateway for base path mapping. Considering this, you can add Base path mapping with custom base path just as you wanted do.

  1. Go to API gateway in AWS console
  2. Scroll down to Custom Domain Names
  3. Here you will see your custom domain
  4. Click on EDIT option
  5. Now you can add mapping as "user" or "order" and select which service you need to attach this base path to "api.myapp.com/user/*"

After saving this settings you are able to run API on

Note: You can not use same base path for other service if you have already attached it before.

In case you haven't created a custom domain, first create custom domain in Route 53 and then add that custom domain to API gateway custom domain section to process further

petey
  • 16,914
  • 6
  • 65
  • 97
sidgujrathi
  • 479
  • 4
  • 7
  • 3
    I have done it. It is basic step that provided by console API Gateway. I have added base path mapping for all my services. But, the only one that work is the first one with no path. I have add user service to path "user", order service to path "order" and else. But the only one that working is like what I have told in question above – Adityo Setyonugroho Aug 06 '18 at 06:57
  • 2
    @AdityoSetyonugroho any updates there?, I'm facing same issue. – Bob Zant Mar 13 '20 at 10:15
  • 1
    @AdityoSetyonugroho any updates? I am facing same issue x2 – programing_is_hard Feb 19 '21 at 15:19
  • I'm having the same issue. Has anyone managed to figure this out? – Kevin Glick Jul 27 '21 at 16:35