# CorsRule

Specifies a cross-origin access rule for an Amazon S3 bucket.

- Source: [`aws-s3/lib/bucket.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L1271)

## 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';
const corsRule: s3.CorsRule = {
  allowedMethods: [s3.HttpMethods.GET],
  allowedOrigins: ['allowedOrigins'],

  // the properties below are optional
  allowedHeaders: ['allowedHeaders'],
  exposedHeaders: ['exposedHeaders'],
  id: 'id',
  maxAge: 123,
};
```

## Properties

- `allowedHeaders`: string[] — Headers that are specified in the Access-Control-Request-Headers header.

  **Default:** No headers allowed.

- `allowedMethods`: [HttpMethods](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.HttpMethods.html)[] (required) — An HTTP method that you allow the origin to execute.

- `allowedOrigins`: string[] (required) — One or more origins you want customers to be able to access the bucket from.

- `exposedHeaders`: string[] — One or more headers in the response that you want customers to be able to access from their applications.

  **Default:** No headers exposed.

- `id`: string — A unique identifier for this rule.

  **Default:** No id specified.

- `maxAge`: number — The time in seconds that your browser is to cache the preflight response for the specified resource.

  **Default:** No caching.
