API Gateway Custom Domain Path Mapping Returns 404

47 Views Asked by At

Set up a custom domain in AWS Api Gateway to be the endpoint for all of the APIs being built.

enter image description here

Each API is a simple rest api your typical crud operations:

enter image description here

using postman - if I

POST https://api.customdomain.com/client

I get a 404

If I use the default endpoint for the api (this is before I disabled it) -

POST https://{api-id}.execute-api.us-east-2.amazonaws.com

It works.

I am also able to get by id using the custom domain:

https://api.customdomain.com/client/{id}

Basically anything that does not include the {id} in the path returns a 404 when I used the custom domain / path - but the same api works if I used the default endpoint (no path added).

I disabled the default endpoint because of this post. (no luck)

Another thing I've noticed is NONE of the requests that do not have the {id} in the path are hitting the api (when using the custom domain name). I don't see any requests for POST / in the api gateway logs. But I do see GET /{id}.

UPDATE

So I got it to work - but I hate it.

The issue was I was not including a trailing slash "/" in the url.

i.e. https://api.customdomain.com/client/ <---

Need to figure out if there is a way around that. Consumers of the api are not going to include that.

0

There are 0 best solutions below