class CustomRule
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Amplify.CustomRule |
Java | software.amazon.awscdk.services.amplify.CustomRule |
Python | aws_cdk.aws_amplify.CustomRule |
TypeScript (source) | @aws-cdk/aws-amplify 禄 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
Custom
Rule Options
Properties
Name | Type | Description |
---|---|---|
source | string | The source pattern for a URL rewrite or redirect rule. |
target | string | The target pattern for a URL rewrite or redirect rule. |
condition? | string | The condition for a URL rewrite or redirect rule, e.g. country code. |
status? | Redirect | The status code for a URL rewrite or redirect rule. |
static SINGLE_PAGE_APPLICATION_REDIRECT | Custom | Sets 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:
Redirect
(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:
Custom
Sets up a 200 rewrite for all paths to index.html
except for path containing a file extension.