# FunctionUrlCorsOptions

Specifies a cross-origin access property for a function URL.

- Source: [`aws-lambda/lib/function-url.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-lambda/lib/function-url.ts#L90)
- Type last changed: v2.21.0 · 22 Apr 2022

## Example

```ts
declare const fn: lambda.Function;

fn.addFunctionUrl({
  authType: lambda.FunctionUrlAuthType.NONE,
  cors: {
    // Allow this to be called from websites on https://example.com.
    // Can also be ['*'] to allow all domain.
    allowedOrigins: ['https://example.com'],

    // More options are possible here, see the documentation for FunctionUrlCorsOptions
  },
});
```

## Properties

- `allowCredentials`: boolean = false — Whether to allow cookies or other credentials in requests to your function URL.

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

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

- `allowedOrigins`: string[] = No origins allowed. — One or more origins you want customers to be able to access the bucket from.

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

- `maxAge`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Browser default of 5 seconds. — The time in seconds that your browser is to cache the preflight response for the specified resource.
