CORS

class CORS

CORS feature. Please read http://ktor.io/servers/features/cors.html first before using it.

Types

Configuration

class Configuration

CORS feature configuration

Feature

companion object Feature : 
    ApplicationFeature<ApplicationCallPipeline, Configuration, CORS>

Feature object for installation

Constructors

<init>

CORS(configuration: Configuration)

CORS feature. Please read http://ktor.io/servers/features/cors.html first before using it.

Properties

allHeaders

val allHeaders: Set<String>

All allowed headers to be sent

allHeadersSet

val allHeadersSet: Set<String>

Set of all allowed headers

allowCredentials

val allowCredentials: Boolean

Allow to pass credentials

allowSameOrigin

val allowSameOrigin: Boolean

Allow requests from the same origin

allowsAnyHost

val allowsAnyHost: Boolean

Allow requests from any origin

headers

val headers: Set<String>

Set of all allowed headers

methods

val methods: HashSet<HttpMethod>

All allowed HTTP methods

Functions

intercept

suspend fun intercept(
    context: PipelineContext<Unit, ApplicationCall>
): Unit

Feature’s call interceptor that does all the job. Usually there is no need to install it as it is done during feature installation

Companion Object Properties

key

val key: AttributeKey<CORS>

Unique key that identifies a feature

Companion Object Functions

install

fun install(
    pipeline: ApplicationCallPipeline,
    configure: Configuration.() -> Unit
): CORS

Feature installation script