Skip to content
v2.274.0

RoutingRule Struct ​

Rule that define when a redirect is applied and the redirect behavior.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';

declare const replaceKey: s3.ReplaceKey;
const routingRule: s3.RoutingRule = {
  condition: {
    httpErrorCodeReturnedEquals: 'httpErrorCodeReturnedEquals',
    keyPrefixEquals: 'keyPrefixEquals',
  },
  hostName: 'hostName',
  httpRedirectCode: 'httpRedirectCode',
  protocol: s3.RedirectProtocol.HTTP,
  replaceKey: replaceKey,
};

Properties ​

Specifies a condition that must be met for the specified redirect to apply.

Default: No condition

hostNamestringhost_namestrhostNameStringHostNamestringHostName*string#
The host name to use in the redirect request.

Default: The host name used in the original request.

httpRedirectCodestringhttp_redirect_codestrhttpRedirectCodeStringHttpRedirectCodestringHttpRedirectCode*string#
The HTTP redirect code to use on the response.

Default: "301" - Moved Permanently

Protocol to use when redirecting requests.

Default: The protocol used in the original request.

replaceKeyReplaceKeyreplace_keyReplaceKeyreplaceKeyReplaceKeyReplaceKeyReplaceKeyReplaceKeyReplaceKey#
Specifies the object key prefix to use in the redirect request.

Default: The key will not be replaced