16

I'm testing to make mobile game server with AWS's Lambda and API gateway. At the API gateway, I try to make custom domain using 2 types endpoint, regional a.domain.com and edge optimized b.domain.com. The edge optimized endpoint is fine, it works.

But the regional endpoint is not working. it returns ERR_CONNECTION_REFUSED. the regional endpoint url can't submit to record set using aws console.

So I'm using aws-cli for editing record set in the route53.

Ele
  • 33,468
  • 7
  • 37
  • 75
Uisang Song
  • 161
  • 1
  • 3
  • Without knowledge of the specific domain name you"re working on and the assigned endpoint hostname that it should be pointing to, it isn't really possible to diagnose this... although the error suggests a DNS misconfiguration, since there is nothing you could do in API Gateway itself that would cause Err Connection Refused -- that implies you're somehow connecting to a system that is online but doesn't actually have a web server running... and this not a condition that you could cause either accidentally or deliberately, with API Gateway. – Michael - sqlbot Jan 18 '18 at 01:37
  • have you had any luck with this? – Victor Mar 02 '19 at 14:55
  • I have a similar issue but get a 403 {"message":"Forbidden"}. I'm guessing that means my custom domain is actually resolving - so could be a different issue. My REST APIs work, but my HTTP one refuses to. – square_eyes Aug 13 '20 at 06:07
  • @square_eyes were you able to resolve forbidden error for custom domain? – uni Dec 15 '21 at 11:37

2 Answers2

36

I had the same issue.

It appears that when using API Gateway with regional custom domains only HTTPS is supported and API Gateway does not redirect from HTTP to HTTPS.

So just use https://a.domain.com

RomanHotsiy
  • 4,978
  • 1
  • 25
  • 36
0

If you are still getting the 403 {"message":"Forbidden"} response it's because you are probably trying to call the endpoint from the API Gateway domain name generated by the regional endpoint e.g. from d-387h3iudnb.execute-api.us-east-2.amazonaws.com. Once you create the CNAME in your custom domain name, pointing to that url you will get the correct response.

For example your custom domain is api.example.com you should create a CNAME on that subdomain to point to your API Gateway generated domain name (e.g. d-387h3iudnb.execute-api.us-east-2.amazonaws.com). Then you can call your api from api.example.com without problems.

More info in here

Mark Hkr
  • 620
  • 2
  • 7
  • 15