Have an endpoint use http rather than https

I am rewriting an application using serverless. For legacy reasons I need to access an endpoint using http rather than https. Right now when I try to use http I get a redirect to https rather than the data I need. How I can setup an http endpiont rather than an https one?

Currently tis is the response I get with http

http get http://9lu88q2p7i.execute-api.us-east-1.amazonaws.com/staging/test
HTTP/1.1 301 Moved Permanently
Connection: keep-alive
Content-Length: 183
Content-Type: text/html
Date: Tue, 16 Jan 2018 09:31:51 GMT
Location: https://9lu88q2p7i.execute-api.us-east-1.amazonaws.com/staging/test
Server: CloudFront
Via: 1.1 861b49a34b383ce3ac4ea8b7117b8953.cloudfront.net (CloudFront)
X-Amz-Cf-Id: ChUFZEU_3HnRNB-dTYvZPtly0QiPgppSFE1t5BaJ5YIiNwc1IC2CZg==
X-Cache: Redirect from cloudfront

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>

I want it to look like this https response

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 4
Content-Type: application/json
Date: Tue, 16 Jan 2018 09:38:17 GMT
Via: 1.1 b790a9f06b09414fec5d8b87e81d4b7f.cloudfront.net (CloudFront)
X-Amz-Cf-Id: CjdFFBHTBTROgY_-c08vgTmPOIo2Jj5QPF6ihKHNkKB8on8q5YUIVA==
X-Amzn-Trace-Id: sampled=0;root=1-5a5dc809-33b5ff3672e71b5c73dd3bfb
X-Cache: Miss from cloudfront
x-amzn-RequestId: fb4d54ce-faa0-11e7-bc24-b37f137d756a

data

https://aws.amazon.com/api-gateway/faqs/

Q: Can I create HTTPS endpoints?

Yes, all of the APIs created with Amazon API Gateway expose HTTPS endpoints only. Amazon API Gateway does not support unencrypted (HTTP) endpoints. By default, Amazon API Gateway assigns an internal domain to the API that automatically uses the Amazon API Gateway certificate. When configuring your APIs to run under a custom domain name, you can provide your own certificate for the domain.

2 Likes

Thanks Bill. It looks like AWS does not support what I need. I will have to figure out a workaround for this :frowning_face: At least I can stop beating my head against a wall trying to make a round peg fit a square hole.

Hi @gap, just having the same issue, did you solve it?


Ok, the solution is to use REGIONAL API GATEWAY, and manually create cloudfront that point to stage endpoints and allow HTTP at the cloudfront side :wink:

I think the only reason people use the rest api gateway is to not have REGIONAL api gateway. Because they want to use the private version. Kind of defeats the purpose.