HttpsRedirect L3 construct
Allows creating a domainA -> domainB redirect using CloudFront and S3.
You can specify multiple domains to be redirected.
Example
new patterns.HttpsRedirect(this, 'Redirect', {
recordNames: ['foo.example.com'],
targetDomain: 'bar.example.com',
zone: route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', {
hostedZoneId: 'ID',
zoneName: 'example.com',
}),
});
patterns.HttpsRedirect(self, "Redirect",
record_names=["foo.example.com"],
target_domain="bar.example.com",
zone=route53.HostedZone.from_hosted_zone_attributes(self, "HostedZone",
hosted_zone_id="ID",
zone_name="example.com"
)
)
HttpsRedirect.Builder.create(this, "Redirect")
.recordNames(List.of("foo.example.com"))
.targetDomain("bar.example.com")
.zone(HostedZone.fromHostedZoneAttributes(this, "HostedZone", HostedZoneAttributes.builder()
.hostedZoneId("ID")
.zoneName("example.com")
.build()))
.build();
// Install: dotnet add package Amazon.CDK.Lib
new HttpsRedirect(this, "Redirect", new HttpsRedirectProps {
RecordNames = new [] { "foo.example.com" },
TargetDomain = "bar.example.com",
Zone = HostedZone.FromHostedZoneAttributes(this, "HostedZone", new HostedZoneAttributes {
HostedZoneId = "ID",
ZoneName = "example.com"
})
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
patterns.NewHttpsRedirect(this, jsii.String("Redirect"), &HttpsRedirectProps{
RecordNames: []*string{
jsii.String("foo.example.com"),
},
TargetDomain: jsii.String("bar.example.com"),
Zone: route53.HostedZone_FromHostedZoneAttributes(this, jsii.String("HostedZone"), &HostedZoneAttributes{
HostedZoneId: jsii.String("ID"),
ZoneName: jsii.String("example.com"),
}),
})
Initializer
new HttpsRedirect(scope: Construct, id: string, props: HttpsRedirectProps)
HttpsRedirect(scope: Construct, id: str, props: HttpsRedirectProps)
new HttpsRedirect(Construct scope, String id, HttpsRedirectProps props)
new HttpsRedirect(Construct scope, string id, HttpsRedirectProps props)
NewHttpsRedirect(Scope Construct, Id *string, Props HttpsRedirectProps)
Construct Props
certificateoptionalICertificateRefcertificateoptionalICertificateRefcertificateoptionalICertificateRefCertificateoptionalICertificateRefCertificateoptionalICertificateRef#Default: A new certificate is created in us-east-1 (N. Virginia)
If provided, the certificate must be stored in us-east-1 (N. Virginia)
recordNamesoptionalstring[]record_namesoptionaltyping.List[str]recordNamesoptionalList<String>RecordNamesoptionalstring[]RecordNamesoptional*[]*string#Default: the domain name of the hosted zone
An alias record will be created that points to your CloudFront distribution. Root domain or sub-domain can be supplied.
notes
The hosted zone must contain entries for the domain name(s) supplied through recordNames that will redirect to the target domain.
Domain names in the hosted zone can include a specific domain (example.com) and its subdomains (acme.example.com, zenith.example.com).
Properties
Methods
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining