# HttpsRedirect

Allows creating a domainA -> domainB redirect using CloudFront and S3.

You can specify multiple domains to be redirected.

Extends: Construct › HttpsRedirect
Implements: IConstruct, IDependable

- Source: [`aws-route53-patterns/lib/website-redirect.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-route53-patterns/lib/website-redirect.ts#L62)

## Example

```ts
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

```ts
new HttpsRedirect(scope: Construct, id: string, props: HttpsRedirectProps)
```

## Construct Props

- `certificate`: [ICertificateRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_certificatemanager.ICertificateRef.html) — The AWS Certificate Manager (ACM) certificate that will be associated with the CloudFront distribution that will be created.

  **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)

- `recordNames`: string[] — The domain names that will redirect to `targetDomain`.

  **Default:** the domain name of the hosted zone

- `targetDomain`: string (required) — 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`: [IHostedZone](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.IHostedZone.html) (required) — 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).

## Properties

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

## Methods

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  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**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — 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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
