aws-cdk-lib.aws_s3.CfnBucket.RedirectRuleProperty

interface RedirectRuleProperty

LanguageType name
.NETAmazon.CDK.AWS.S3.CfnBucket.RedirectRuleProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awss3#CfnBucket_RedirectRuleProperty
Javasoftware.amazon.awscdk.services.s3.CfnBucket.RedirectRuleProperty
Pythonaws_cdk.aws_s3.CfnBucket.RedirectRuleProperty
TypeScript aws-cdk-lib » aws_s3 » CfnBucket » RedirectRuleProperty

Specifies how requests are redirected.

In the event of an error, you can specify a different error code to return.

Example

// 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';
const redirectRuleProperty: s3.CfnBucket.RedirectRuleProperty = {
  hostName: 'hostName',
  httpRedirectCode: 'httpRedirectCode',
  protocol: 'protocol',
  replaceKeyPrefixWith: 'replaceKeyPrefixWith',
  replaceKeyWith: 'replaceKeyWith',
};

Properties

NameTypeDescription
hostName?stringThe host name to use in the redirect request.
httpRedirectCode?stringThe HTTP redirect code to use on the response.
protocol?stringProtocol to use when redirecting requests.
replaceKeyPrefixWith?stringThe object key prefix to use in the redirect request.
replaceKeyWith?stringThe specific object key to use in the redirect request.

hostName?

Type: string (optional)

The host name to use in the redirect request.


httpRedirectCode?

Type: string (optional)

The HTTP redirect code to use on the response.

Not required if one of the siblings is present.


protocol?

Type: string (optional)

Protocol to use when redirecting requests.

The default is the protocol that is used in the original request.


replaceKeyPrefixWith?

Type: string (optional)

The object key prefix to use in the redirect request.

For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/ , you can set a condition block with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /documents . Not required if one of the siblings is present. Can be present only if ReplaceKeyWith is not provided.

Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints .


replaceKeyWith?

Type: string (optional)

The specific object key to use in the redirect request.

For example, redirect request to error.html . Not required if one of the siblings is present. Can be present only if ReplaceKeyPrefixWith is not provided.

Replacement must be made for object keys containing special characters (such as carriage returns) when using XML requests. For more information, see XML related object key constraints .