HTTP API Custom Domain not working
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.
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
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).
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.
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!
Relevant questions
can we attach the custom domain to lambda function urls ?
Accepted Answerasked 2 months agoAPI HTTP Gateway path rewrite question
asked 5 days agoHTTP API GW + API VPC Link + Cloudmap + Fargate - How does it load balance
Accepted Answerasked 4 months agoReturn a custom header from lambda authorizer in API-gateway (HTTP api)
asked a month agoPublic APIGW Rest Api proxy to private Fargate App in VPC via VPC Link
asked 6 months agoWhy aren't the HTTP headers passed from API Gateway to Step Functions?
asked 6 months agoHTTP API - Custom Domain (Regional) - incorrect SSL cert?
asked 2 years agoProtect HTTP Api Gateway with WAF
asked 3 months agoCustom domain name not resolvable
asked 2 years agoHTTP API Custom Domain not working
Accepted Answerasked 3 months ago
Are you able to reach the target but a request parameter is missing? Or are you not even able to reach the API?