Skip to content
v2.278.0

HttpOriginProps Struct ​

Properties for an Origin backed by an S3 website-configured bucket, load balancer, or custom HTTP server.

Example ​

ts
const oac = new cloudfront.S3OriginAccessControl(this, 'MyMrapOAC', {
  signing: cloudfront.Signing.SIGV4A_ALWAYS,
});

new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: {
    origin: new origins.HttpOrigin('mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com', {
      originAccessControlId: oac.originAccessControlId,
    }),
  },
});
python
oac = cloudfront.S3OriginAccessControl(self, "MyMrapOAC",
    signing=cloudfront.Signing.SIGV4A_ALWAYS
)

cloudfront.Distribution(self, "myDist",
    default_behavior=cloudfront.BehaviorOptions(
        origin=origins.HttpOrigin("mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com",
            origin_access_control_id=oac.origin_access_control_id
        )
    )
)
java
S3OriginAccessControl oac = S3OriginAccessControl.Builder.create(this, "MyMrapOAC")
        .signing(Signing.SIGV4A_ALWAYS)
        .build();

Distribution.Builder.create(this, "myDist")
        .defaultBehavior(BehaviorOptions.builder()
                .origin(HttpOrigin.Builder.create("mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com")
                        .originAccessControlId(oac.getOriginAccessControlId())
                        .build())
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var oac = new S3OriginAccessControl(this, "MyMrapOAC", new S3OriginAccessControlProps {
    Signing = Signing.SIGV4A_ALWAYS
});

new Distribution(this, "myDist", new DistributionProps {
    DefaultBehavior = new BehaviorOptions {
        Origin = new HttpOrigin("mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com", new HttpOriginProps {
            OriginAccessControlId = oac.OriginAccessControlId
        })
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
oac := cloudfront.NewS3OriginAccessControl(this, jsii.String("MyMrapOAC"), &S3OriginAccessControlProps{
	Signing: cloudfront.Signing_SIGV4A_ALWAYS(),
})

cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{
	DefaultBehavior: &BehaviorOptions{
		Origin: origins.NewHttpOrigin(jsii.String("mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com"), &HttpOriginProps{
			OriginAccessControlId: oac.OriginAccessControlId,
		}),
	},
})

Properties ​

connectionAttemptsoptionalnumberconnection_attemptsoptionalint | floatconnectionAttemptsoptionalNumberConnectionAttemptsoptionaldoubleConnectionAttemptsoptional*float64 = 3 #
The number of times that CloudFront attempts to connect to the origin;

valid values are 1, 2, or 3 attempts.

connectionTimeoutoptionalDurationconnection_timeoutoptionalDurationconnectionTimeoutoptionalDurationConnectionTimeoutoptionalDurationConnectionTimeoutoptionalDuration = Duration.seconds(10) #
The number of seconds that CloudFront waits when trying to establish a connection to the origin.

Valid values are 1-10 seconds, inclusive.

customHeadersoptional{ [key: string]: string }custom_headersoptionaltyping.Mapping[str, str]customHeadersoptionalMap<String, String>CustomHeadersoptionalIDictionary<string, string>CustomHeadersoptional*map[string]*string = {} #
A list of HTTP header names and values that CloudFront adds to requests it sends to the origin.
httpPortoptionalnumberhttp_portoptionalint | floathttpPortoptionalNumberHttpPortoptionaldoubleHttpPortoptional*float64 = 80 #
The HTTP port that CloudFront uses to connect to the origin.
httpsPortoptionalnumberhttps_portoptionalint | floathttpsPortoptionalNumberHttpsPortoptionaldoubleHttpsPortoptional*float64 = 443 #
The HTTPS port that CloudFront uses to connect to the origin.
ipAddressTypeoptionalOriginIpAddressTypeip_address_typeoptionalOriginIpAddressTypeipAddressTypeoptionalOriginIpAddressTypeIpAddressTypeoptionalOriginIpAddressTypeIpAddressTypeoptionalOriginIpAddressType #
Specifies which IP protocol CloudFront uses when connecting to your origin.

Default: undefined - AWS Cloudfront default is IPv4

If your origin uses both IPv4 and IPv6 protocols, you can choose dualstack to help optimize reliability.

keepaliveTimeoutoptionalDurationkeepalive_timeoutoptionalDurationkeepaliveTimeoutoptionalDurationKeepaliveTimeoutoptionalDurationKeepaliveTimeoutoptionalDuration = Duration.seconds(5) #
Specifies how long, in seconds, CloudFront persists its connection to the origin.
notes

The minimum is 1 second. The maximum is governed by the keep-alive timeout per origin quota, which is adjustable, so the effective maximum depends on the target account.

The default quota allows up to 300 seconds; higher values require an approved limit increase in the target account, and otherwise produce an error at deploy time.

originAccessControlIdoptionalstringorigin_access_control_idoptionalstroriginAccessControlIdoptionalStringOriginAccessControlIdoptionalstringOriginAccessControlIdoptional*string #
The unique identifier of an origin access control for this origin.

Default: no origin access control

originIdoptionalstringorigin_idoptionalstroriginIdoptionalStringOriginIdoptionalstringOriginIdoptional*string #
A unique identifier for the origin.

Default: an originid will be generated for you

This value must be unique within the distribution.

originPathoptionalstringorigin_pathoptionalstroriginPathoptionalStringOriginPathoptionalstringOriginPathoptional*string = '/' #
An optional path that CloudFront appends to the origin domain name when CloudFront requests content from the origin.

Must begin, but not end, with '/' (e.g., '/production/images').

originShieldEnabledoptionalbooleanorigin_shield_enabledoptionalbooloriginShieldEnabledoptionalBooleanOriginShieldEnabledoptionalboolOriginShieldEnabledoptional*bool = true #
Origin Shield is enabled by setting originShieldRegion to a valid region, after this to disable Origin Shield again you must set this flag to false.
originShieldRegionoptionalstringorigin_shield_regionoptionalstroriginShieldRegionoptionalStringOriginShieldRegionoptionalstringOriginShieldRegionoptional*string #
When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.

Default: origin shield not enabled

originSslProtocolsoptionalOriginSslPolicy[]origin_ssl_protocolsoptionaltyping.List[OriginSslPolicy]originSslProtocolsoptionalList<OriginSslPolicy>OriginSslProtocolsoptionalOriginSslPolicy[]OriginSslProtocolsoptional*[]OriginSslPolicy = OriginSslPolicy.TLS_V1_2 #
The SSL versions to use when interacting with the origin.
protocolPolicyoptionalOriginProtocolPolicyprotocol_policyoptionalOriginProtocolPolicyprotocolPolicyoptionalOriginProtocolPolicyProtocolPolicyoptionalOriginProtocolPolicyProtocolPolicyoptionalOriginProtocolPolicy = OriginProtocolPolicy.HTTPS_ONLY #
Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin.
readTimeoutoptionalDurationread_timeoutoptionalDurationreadTimeoutoptionalDurationReadTimeoutoptionalDurationReadTimeoutoptionalDuration = Duration.seconds(30) #
Specifies how long, in seconds, CloudFront waits for a response from the origin, also known as the origin response timeout.
notes

The minimum is 1 second. The maximum is governed by the origin response timeout quota, which is adjustable, so the effective maximum depends on the target account.

The default quota allows up to 120 seconds; higher values require an approved limit increase in the target account, and otherwise produce an error at deploy time.

responseCompletionTimeoutoptionalDurationresponse_completion_timeoutoptionalDurationresponseCompletionTimeoutoptionalDurationResponseCompletionTimeoutoptionalDurationResponseCompletionTimeoutoptionalDuration #
The time that a request from CloudFront to the origin can stay open and wait for a response.

Default: undefined - AWS CloudFront default is not enforcing a maximum value

If the complete response isn't received from the origin by this time, CloudFront ends the connection.

Valid values are 1-3600 seconds, inclusive.