I am testing the web page in localhost by http://test.localhost:8000/test/account and it's working fine. However, how can I get the Endpoint url for creating the API uses http? Aws api gateway seems doesn't support the localhost url for testing.
1 Answers
I'm not sure quite what you're asking here, but here are a couple of options.
If you're asking "how do I find out what URL I need to go to to 'see' my API Gateway API in action, you can find this in the AWS web console (see https://stackoverflow.com/a/44539898/4473685 for detailed steps).
If you're asking "can I 'see' my API Gateway API at a url ending in "localhost", the answer is "no". *.localhost urls 'point to' your own local computer rather than computers on the internet. All API Gateway urls are of the form https://{api_id}.execute-api.{aws_region}.amazonaws.com. You can 'point' your own custom domain to the API (so you point your domain foo.example.com to AWS and you can then 'see' your API Gateway API by visiting https://foo.example.com), but this only works for domains which are routable on the internet, like *.com, not *.localhost.
If you're asking "can I access my API Gateway API over HTTP rather than HTTPS" (ie by visiting http://api_id.execute-api.aws_region.amazonaws.com rather than https://api_id.execute-api.aws_region.amazonaws.com, the answer is "no". API Gateway only supports communicating over HTTPS.

- 1,657
- 13
- 10