CustomRule

class aws_cdk.aws_amplify_alpha.CustomRule(*, source, target, condition=None, status=None)

Bases: object

(experimental) Custom rewrite/redirect rule for an Amplify App.

See:

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

Stability:

experimental

ExampleMetadata:

infused

Example:

# amplify_app: amplify.App

amplify_app.add_custom_rule({
    "source": "/docs/specific-filename.html",
    "target": "/documents/different-filename.html",
    "status": amplify.RedirectStatus.TEMPORARY_REDIRECT
})
Parameters:
  • source (str) – (experimental) The source pattern for a URL rewrite or redirect rule.

  • target (str) – (experimental) The target pattern for a URL rewrite or redirect rule.

  • condition (Optional[str]) – (experimental) The condition for a URL rewrite or redirect rule, e.g. country code. Default: - no condition

  • status (Optional[RedirectStatus]) – (experimental) The status code for a URL rewrite or redirect rule. Default: PERMANENT_REDIRECT

Stability:

experimental

Attributes

SINGLE_PAGE_APPLICATION_REDIRECT = <aws_cdk.aws_amplify_alpha.CustomRule object>
condition

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

Default:
  • no condition

See:

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

Stability:

experimental

source

(experimental) The source pattern for a URL rewrite or redirect rule.

See:

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

Stability:

experimental

status

(experimental) The status code for a URL rewrite or redirect rule.

Default:

PERMANENT_REDIRECT

See:

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

Stability:

experimental

target

(experimental) The target pattern for a URL rewrite or redirect rule.

See:

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

Stability:

experimental