Skip to content
v2.274.0

RoutingRuleCondition Struct ​

Example ​

ts
const bucket = new s3.Bucket(this, 'MyRedirectedBucket', {
  websiteRoutingRules: [
    {
      hostName: 'www.example.com',
      httpRedirectCode: '302',
      protocol: s3.RedirectProtocol.HTTPS,
      replaceKey: s3.ReplaceKey.prefixWith('test/'),
      condition: {
        httpErrorCodeReturnedEquals: '200',
        keyPrefixEquals: 'prefix',
      },
    },
  ],
});

Properties ​

httpErrorCodeReturnedEqualsstringhttp_error_code_returned_equalsstrhttpErrorCodeReturnedEqualsStringHttpErrorCodeReturnedEqualsstringHttpErrorCodeReturnedEquals*string#
The HTTP error code when the redirect is applied.

Default: The HTTP error code will not be verified

In the event of an error, if the error code equals this value, then the specified redirect is applied.

If both condition properties are specified, both must be true for the redirect to be applied.

keyPrefixEqualsstringkey_prefix_equalsstrkeyPrefixEqualsStringKeyPrefixEqualsstringKeyPrefixEquals*string#
The object key name prefix when the redirect is applied.

Default: The object key name will not be verified

If both condition properties are specified, both must be true for the redirect to be applied.