interface CorsRule
| Language | Type name | 
|---|---|
|  .NET | Amazon.CDK.AWS.S3.CorsRule | 
|  Go | github.com/aws/aws-cdk-go/awscdk/v2/awss3#CorsRule | 
|  Java | software.amazon.awscdk.services.s3.CorsRule | 
|  Python | aws_cdk.aws_s3.CorsRule | 
|  TypeScript (source) | aws-cdk-lib»aws_s3»CorsRule | 
Specifies a cross-origin access rule for an Amazon S3 bucket.
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 corsRule: s3.CorsRule = {
  allowedMethods: [s3.HttpMethods.GET],
  allowedOrigins: ['allowedOrigins'],
  // the properties below are optional
  allowedHeaders: ['allowedHeaders'],
  exposedHeaders: ['exposedHeaders'],
  id: 'id',
  maxAge: 123,
};
Properties
| Name | Type | Description | 
|---|---|---|
| allowed | Http[] | An HTTP method that you allow the origin to execute. | 
| allowed | string[] | One or more origins you want customers to be able to access the bucket from. | 
| allowed | string[] | Headers that are specified in the Access-Control-Request-Headers header. | 
| exposed | string[] | One or more headers in the response that you want customers to be able to access from their applications. | 
| id? | string | A unique identifier for this rule. | 
| max | number | The time in seconds that your browser is to cache the preflight response for the specified resource. | 
allowedMethods
Type:
Http[]
An HTTP method that you allow the origin to execute.
allowedOrigins
Type:
string[]
One or more origins you want customers to be able to access the bucket from.
allowedHeaders?
Type:
string[]
(optional, default: No headers allowed.)
Headers that are specified in the Access-Control-Request-Headers header.
exposedHeaders?
Type:
string[]
(optional, default: No headers exposed.)
One or more headers in the response that you want customers to be able to access from their applications.
id?
Type:
string
(optional, default: No id specified.)
A unique identifier for this rule.
maxAge?
Type:
number
(optional, default: No caching.)
The time in seconds that your browser is to cache the preflight response for the specified resource.
