Skip to content
v2.273.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.
hostNamestringhost_namestrhostNameStringHostNamestringHostName*string= The host name used in the origin…#
The host name to use in the redirect request.
default

Default: The host name used in the original request.

httpRedirectCodestringhttp_redirect_codestrhttpRedirectCodeStringHttpRedirectCodestringHttpRedirectCode*string= "301" - Moved Permanently#
The HTTP redirect code to use on the response.
protocolRedirectProtocolprotocolRedirectProtocolprotocolRedirectProtocolProtocolRedirectProtocolProtocolRedirectProtocol= The protocol used in the origina…#
Protocol to use when redirecting requests.
default

Default: The protocol used in the original request.

replaceKeyReplaceKeyreplace_keyReplaceKeyreplaceKeyReplaceKeyReplaceKeyReplaceKeyReplaceKeyReplaceKey= The key will not be replaced#
Specifies the object key prefix to use in the redirect request.