Search code examples
amazon-web-servicesaws-api-gatewayamazon-elbelastic-load-balancerapi-gateway

Redirect to public ELB from AWS ApiGateway


Im trying to redirect a call from api gateway to a public elb in AWS. The ELB is open to the world but I cannot make it work going by the API Gateway.

API GateWayConfiguration

I get this response from the postman when I call the events operation { "message": "Internal server error" }

And from AWS test console, Im getting this error:

Wed Jan 17 20:29:12 UTC 2018 : Execution failed due to configuration error: Host name 'public-elb.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.confidential.com) Wed Jan 17 20:29:12 UTC 2018 : Method completed with status: 500

I assume that the ELB is reachable because then I change to another random URL, the error code is "Invalid endpoint address".

Why am I getting this error? I only have one certificate and is the same in the url and the elb.


Solution

  • Your error is caused by the SSL certificate having the common name "*.confidential.com" and you are redirecting to a different name "public-elb.amazonaws.com"

    The solution is to create an ALIAS (preferred) or CNAME record in DNS that maps your domain name to the ELB dns name. Then use that name in your redirect.