Skip to content
v2.275.0

HttpOrigin Class ​

An Origin for an HTTP server or S3 bucket configured for website hosting.

Example ​

ts
declare const regionalEndpointDomainName: string;

const oac = new cloudfront.FunctionUrlOriginAccessControl(this, 'WebFunctionOAC', {
  signing: cloudfront.Signing.SIGV4_ALWAYS_AMZ_AUTH,
});

new cloudfront.Distribution(this, 'MyDistribution', {
  defaultBehavior: {
    origin: new origins.HttpOrigin(regionalEndpointDomainName, {
      originAccessControlId: oac.originAccessControlId,
    }),
  },
});
python
# regional_endpoint_domain_name: str


oac = cloudfront.FunctionUrlOriginAccessControl(self, "WebFunctionOAC",
    signing=cloudfront.Signing.SIGV4_ALWAYS_AMZ_AUTH
)

cloudfront.Distribution(self, "MyDistribution",
    default_behavior=cloudfront.BehaviorOptions(
        origin=origins.HttpOrigin(regional_endpoint_domain_name,
            origin_access_control_id=oac.origin_access_control_id
        )
    )
)
java
String regionalEndpointDomainName;


FunctionUrlOriginAccessControl oac = FunctionUrlOriginAccessControl.Builder.create(this, "WebFunctionOAC")
        .signing(Signing.SIGV4_ALWAYS_AMZ_AUTH)
        .build();

Distribution.Builder.create(this, "MyDistribution")
        .defaultBehavior(BehaviorOptions.builder()
                .origin(HttpOrigin.Builder.create(regionalEndpointDomainName)
                        .originAccessControlId(oac.getOriginAccessControlId())
                        .build())
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
string regionalEndpointDomainName;


var oac = new FunctionUrlOriginAccessControl(this, "WebFunctionOAC", new FunctionUrlOriginAccessControlProps {
    Signing = Signing.SIGV4_ALWAYS_AMZ_AUTH
});

new Distribution(this, "MyDistribution", new DistributionProps {
    DefaultBehavior = new BehaviorOptions {
        Origin = new HttpOrigin(regionalEndpointDomainName, new HttpOriginProps {
            OriginAccessControlId = oac.OriginAccessControlId
        })
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var regionalEndpointDomainName string


oac := cloudfront.NewFunctionUrlOriginAccessControl(this, jsii.String("WebFunctionOAC"), &FunctionUrlOriginAccessControlProps{
	Signing: cloudfront.Signing_SIGV4_ALWAYS_AMZ_AUTH(),
})

cloudfront.NewDistribution(this, jsii.String("MyDistribution"), &DistributionProps{
	DefaultBehavior: &BehaviorOptions{
		Origin: origins.NewHttpOrigin(regionalEndpointDomainName, &HttpOriginProps{
			OriginAccessControlId: oac.OriginAccessControlId,
		}),
	},
})

Initializer ​

ts
new HttpOrigin(domainName: string, props?: HttpOriginProps)
python
HttpOrigin(domain_name: str, props: typing.Optional[HttpOriginProps] = None)
java
new HttpOrigin(String domainName, HttpOriginProps props)
csharp
new HttpOrigin(string domainName, HttpOriginProps? props = null)
go
NewHttpOrigin(DomainName *string, Props HttpOriginProps)

Methods ​

bind(scope: Construct, options: OriginBindOptions): OriginBindConfigdef bind(self, scope: Construct, options: OriginBindOptions) -> OriginBindConfigpublic OriginBindConfig bind(Construct scope, OriginBindOptions options)public OriginBindConfig Bind(Construct scope, OriginBindOptions options)func Bind(Scope Construct, Options OriginBindOptions) OriginBindConfig#
Binds the origin to the associated Distribution.

Can be used to grant permissions, create dependent resources, etc.