Description
Even when viewers use HTTPS, CloudFront connects to a custom origin over HTTP if its policy is http-only.
Potential impact
Requests and responses on the origin connection can be read or altered in transit.
Remediation
Install a certificate that CloudFront trusts and that covers the origin domain or the Host name in the origin request. Set CustomOriginConfig.OriginProtocolPolicy to https-only. Request an uncached object to confirm that CloudFront can fetch it.
Examples
Replace app.example.com with the actual origin host. An S3 website endpoint supports only HTTP, so use an HTTPS-capable origin if this connection must be encrypted.
Before
yaml
Resources:
WebDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
- DomainName: app.example.com
Id: app-origin
CustomOriginConfig:
OriginProtocolPolicy: http-only
After
yaml
Resources:
WebDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
- DomainName: app.example.com
Id: app-origin
CustomOriginConfig:
OriginProtocolPolicy: https-only