@aws-cdk_aws-amplify-alpha.CustomRule

class CustomRule ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Amplify.Alpha.CustomRule
Gogithub.com/aws/aws-cdk-go/awscdkamplifyalpha/v2#CustomRule
Javasoftware.amazon.awscdk.services.amplify.alpha.CustomRule
Pythonaws_cdk.aws_amplify_alpha.CustomRule
TypeScript (source)@aws-cdk/aws-amplify-alpha ยป CustomRule

Custom rewrite/redirect rule for an Amplify App.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html

Example

declare const amplifyApp: amplify.App;
amplifyApp.addCustomRule({
  source: '/docs/specific-filename.html',
  target: '/documents/different-filename.html',
  status: amplify.RedirectStatus.TEMPORARY_REDIRECT,
});

Initializer

new CustomRule(options: CustomRuleOptions)

Parameters

  • options CustomRuleOptions

Properties

NameTypeDescription
source๐Ÿ”นstringThe source pattern for a URL rewrite or redirect rule.
target๐Ÿ”นstringThe target pattern for a URL rewrite or redirect rule.
condition?๐Ÿ”นstringThe condition for a URL rewrite or redirect rule, e.g. country code.
status?๐Ÿ”นRedirectStatusThe status code for a URL rewrite or redirect rule.
static SINGLE_PAGE_APPLICATION_REDIRECT๐Ÿ”นCustomRuleSets up a 200 rewrite for all paths to index.html except for path containing a file extension.

source๐Ÿ”น

Type: string

The source pattern for a URL rewrite or redirect rule.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html


target๐Ÿ”น

Type: string

The target pattern for a URL rewrite or redirect rule.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html


condition?๐Ÿ”น

Type: string (optional, default: no condition)

The condition for a URL rewrite or redirect rule, e.g. country code.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html


status?๐Ÿ”น

Type: RedirectStatus (optional, default: PERMANENT_REDIRECT)

The status code for a URL rewrite or redirect rule.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html


static SINGLE_PAGE_APPLICATION_REDIRECT๐Ÿ”น

Type: CustomRule

Sets up a 200 rewrite for all paths to index.html except for path containing a file extension.