# Class: CorsHandler

## vertx-web-js/cors_handler~ CorsHandler

#### new CorsHandler()

A handler which implements server side http://www.w3.org/TR/cors/[CORS] support for Vert.x-Web.

Source:
  - vertx-web-js/cors_handler.js, line 30

### Methods

#### allowCredentials(allow) → {CorsHandler}

Set whether credentials are allowed. Note that user agents will block requests that use a wildcard as origin and include credentials. From the MDN documentation you can read:

> Important note: when responding to a credentialed request, server must specify a domain, and cannot use wild carding.

##### Parameters:

Name | Type | Description
--- | --- | ---
`allow` | boolean | true if allowed

Source:
  - vertx-web-js/cors_handler.js, line 137

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler

#### allowedHeader(headerName) → {CorsHandler}

Add an allowed header

##### Parameters:

Name | Type | Description
--- | --- | ---
`headerName` | string | the allowed header name

Source:
  - vertx-web-js/cors_handler.js, line 69

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler

#### allowedHeaders(headerNames) → {CorsHandler}

Add a set of allowed headers

##### Parameters:

Name | Type | Description
--- | --- | ---
`headerNames` | Array.<string> | the allowed header names

Source:
  - vertx-web-js/cors_handler.js, line 84

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler

#### allowedMethod(method) → {CorsHandler}

Add an allowed method

##### Parameters:

Name | Type | Description
--- | --- | ---
`method` | Object | the method to add

Source:
  - vertx-web-js/cors_handler.js, line 54

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler

#### exposedHeader(headerName) → {CorsHandler}

Add an exposed header

##### Parameters:

Name | Type | Description
--- | --- | ---
`headerName` | string | the exposed header name

Source:
  - vertx-web-js/cors_handler.js, line 99

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler

#### exposedHeaders(headerNames) → {CorsHandler}

Add a set of exposed headers

##### Parameters:

Name | Type | Description
--- | --- | ---
`headerNames` | Array.<string> | the exposed header names

Source:
  - vertx-web-js/cors_handler.js, line 114

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler

#### handle(arg0)

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg0` | RoutingContext |

Source:
  - vertx-web-js/cors_handler.js, line 40

#### maxAgeSeconds(maxAgeSeconds) → {CorsHandler}

Set how long the browser should cache the information

##### Parameters:

Name | Type | Description
--- | --- | ---
`maxAgeSeconds` | number | max age in seconds

Source:
  - vertx-web-js/cors_handler.js, line 152

##### Returns:

a reference to this, so the API can be used fluently

Type
  CorsHandler