I have an HTTP API in AWS API Gateway that has got integration with an internal ALB using a VPC link. Everything's working correctly when I'm accessing using the default endpoint (e.g. https://<api-id>.execute-api.ap-southeast-2.amazonaws.com) and $default stage URLs (e.g. https://<api-id>.execute-api.ap-southeast-2.amazonaws.com/my/endpoint).
But when I create a new stage (e.g. dev) and add /dev when accessing the routes, I get an HTTP 404 error (e.g. (https://<api-id>.execute-api.ap-southeast-2.amazonaws.com/dev/my/endpoint)
Another thing, it's also not working when I use a custom domain and a path based mapping, even when it's pointed to the $default stage.
Some other things I've tried:
- Disabling the default endpoint so it's only accessible via the custom domain
- Deleting the
$defaultstage so there's onlydev - Delete and re-add the path based mapping on the custom domain
Just wondering if anyone else have come across this issue before?
1st problem: it is either related to your integration (make sure you have the right configuration pointing to the correct backend endpoint) or deployment (make sure you deploy the latest changes to your newly created stage).
2nd problem: looks like you are setting a value to the optional 'path' field when configuring an API mapping for your custom domain. In this case, the request will go to a route including the additional path value. For example, if you have an API with
/myapipath defined in your backend and if you add a value in the AGW such asmypath, then the request will be directed to/mypath/myapi. Therefore, you must ensure that path is available in your backend.