class HttpsRedirect (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Route53.Patterns.HttpsRedirect |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsroute53patterns#HttpsRedirect |
Java | software.amazon.awscdk.services.route53.patterns.HttpsRedirect |
Python | aws_cdk.aws_route53_patterns.HttpsRedirect |
TypeScript (source) | aws-cdk-lib » aws_route53_patterns » HttpsRedirect |
Implements
IConstruct, IDependable
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',
}),
});
Initializer
new HttpsRedirect(scope: Construct, id: string, props: HttpsRedirectProps)
Parameters
- scope
Construct - id
string - props
HttpsRedirect Props
Construct Props
| Name | Type | Description |
|---|---|---|
| target | string | The redirect target fully qualified domain name (FQDN). |
| zone | IHosted | Hosted zone of the domain which will be used to create alias record(s) from domain names in the hosted zone to the target domain. |
| certificate? | ICertificate | The AWS Certificate Manager (ACM) certificate that will be associated with the CloudFront distribution that will be created. |
| record | string[] | The domain names that will redirect to targetDomain. |
targetDomain
Type:
string
The redirect target fully qualified domain name (FQDN).
An alias record will be created that points to your CloudFront distribution. Root domain or sub-domain can be supplied.
zone
Type:
IHosted
Hosted zone of the domain which will be used to create alias record(s) from domain names in the hosted zone to the target domain.
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).
certificate?
Type:
ICertificate
(optional, default: A new certificate is created in us-east-1 (N. Virginia))
The AWS Certificate Manager (ACM) certificate that will be associated with the CloudFront distribution that will be created.
If provided, the certificate must be stored in us-east-1 (N. Virginia)
recordNames?
Type:
string[]
(optional, default: the domain name of the hosted zone)
The domain names that will redirect to targetDomain.
Properties
| Name | Type | Description |
|---|---|---|
| node | Node | The tree node. |
node
Type:
Node
The tree node.
Methods
| Name | Description |
|---|---|
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin— The mixins to apply.
Returns
Applies one or more mixins to this construct.
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.

.NET
Go
Java
Python
TypeScript (