I have a setup of API Gateway proxying all the requests to my EC2 instances behind load balancer (ALB). But I want api endpoint to have a nice domain my-api.mydomain.com
. I'm trying to accomplish that via custom domains.
Then I register Target Domain Name
generated in Route53 like this
and my http proxy setup is just a passthrough to the ALB which manages requests to underlying EC2 instances providing business logic.
This setup doesn't work, so I'm wondering what's wrong with this configuration and what critical conceptual thing I have missed. Doing curl -SL https://my-api.mydomain.com/v1/records/
(or any api endpoint) throws {"message": "Internal server error"}
. CloudWatch logs shows
Execution failed due to configuration error: Host name 'my-api-lb-111222333.us-east-1.elb.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.mydomain.com)
I'd be grateful for any suggestions.
host
header is whitelisted for forwarding in the CloudFront Cache Behavior settings and the cert on the ALB matches the domain name pointed to the front side of CloudFront. That would also be cheaper if there's no need for API Gateway advanced capabilities ("http proxy setup is just a passthrough"). Hmmm.