vertx / io.vertx.ext.web.handler / CorsHandler

CorsHandler

interface CorsHandler : Handler<RoutingContext>

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

Author
Tim Fox

Functions

allowCredentials

abstract fun allowCredentials(allow: Boolean): 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.

allowedHeader

abstract fun allowedHeader(headerName: String): CorsHandler

Add an allowed header

allowedHeaders

abstract fun allowedHeaders(headerNames: MutableSet<String>): CorsHandler

Add a set of allowed headers

allowedMethod

abstract fun allowedMethod(method: HttpMethod): CorsHandler

Add an allowed method

allowedMethods

abstract fun allowedMethods(methods: MutableSet<HttpMethod>): CorsHandler

Add a set of allowed methods

create

open static fun create(allowedOriginPattern: String): CorsHandler

Create a CORS handler

exposedHeader

abstract fun exposedHeader(headerName: String): CorsHandler

Add an exposed header

exposedHeaders

abstract fun exposedHeaders(headerNames: MutableSet<String>): CorsHandler

Add a set of exposed headers

maxAgeSeconds

abstract fun maxAgeSeconds(maxAgeSeconds: Int): CorsHandler

Set how long the browser should cache the information