HTTP API Custom Domain not working

1

Hello,

We have an HTTP API Gateway setup with a VPC Link mapping to an ALB which serves the request from an ECS Fargate Task.

I have set up a Regional Custom Domain Name for my api like xyz.abc.com. The result is a Target Domain Name in the form of: d-xxxxx.execute-api.eu-central-1.amazonaws.com

I added the Route53 Alias from my xyz.abc.com to the above "API Gateway domain name". xyz.abc.com A ALIAS d-xxxx.execute-api.eu-central-1.amazonaws.com

I added the API mapping of the custom domain on stage "$default" with no path configured. Neither https://d-xxxx.execute-api.eu-central-1.amazonaws.com nor my custom domain navigates to my API (400 Bad request). But https://[ApiId].execute-api.eu-central-1.amazonaws.com does. There is a query param in the URL which the ECS task doesn't find according to the logs when trying to use the custom domain or the https://d-xxxx.execute-api.eu-central-1.amazonaws.com.

  • Are you able to reach the target but a request parameter is missing? Or are you not even able to reach the API?

  • We are able to reach the target both of the time. But we're getting a 400 status code when we try to access it via xyz.abc.com or d-xxxx.execute-api.eu-central-1.amazonaws.com. We get the correct response when trying to access the endpoint via https://[ApiId].execute-api.eu-central-1.amazonaws.com

    The URL in both cases are the same, the only difference being the domain. The logs suggest that the request is missing query string param when called through xyz.abc.com or d-xxxx.execute-api.eu-central-1.amazonaws.com domain

asked 2 years ago1310 views
2 Answers
1

Hello,

Tim here from the AWS Support Team.

Sorry to hear you're having issues with your HTTP API. Based on the description I'm not quite sure at the moment what the exact cause may be (Thanks Uri for helping out!).

I'd like to ask if you can open up an AWS Support case with us? We'd love to take a peek at the account specific items, and we can have multiple teams assist us on that medium (Route53, API Gateway, others if needed).

AWS
SUPPORT ENGINEER
Tim_P
answered 2 years ago
  • My understanding is that query string parameters are not forwarded to the VPC Link integration when using either of the custom domain name options (https://d-xxxx.execute-api.eu-central-1.amazonaws.com or xyz.abc.com)

  • Thank you for the suggestion, Tim. I did end up opening a support case and was able to get this issue resolved! Our API Gateway route had a proxy pass with any method configured which was the culprit. We had to explicitly configure each and every method after which we were able to get this working.

0
Accepted Answer

For anyone using HTTP API and the proxy route ANY /{proxy+}

You will need to explicitly define your route methods in order for custom domain routing and CORS to work. Wish this was more explicit in the documentation but hopefully this can help people facing this issue some time!

answered 2 years ago
  • Can you elaborate on this answer?

    explicitly define your route methods

    The point of using ANY /{proxy+} is to not explicitly define the routes. So doesn't that makes this practically speaking incompatible?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions