https://kotlinlang.org logo
Title
j

Júlio Santos

09/10/2020, 7:39 PM
Hello everyone, everything good? I'm using ktor and I want to use
"'Access-Control-Allow-Origin': '*'"
, has anyone done this?
j

John O'Reilly

09/10/2020, 7:46 PM
you should be able to use
install(CORS)
with appropriate config
j

Júlio Santos

09/10/2020, 7:47 PM
Thanks for the answer, yes I'm doing it
I'm setting it up this way
install(CORS) {
        method(HttpMethod.Options)
        method(<http://HttpMethod.Post|HttpMethod.Post>)
        method(HttpMethod.Get)
        method(HttpMethod.Put)
        method(HttpMethod.Delete)
        method(HttpMethod.Head)
        header(HttpHeaders.AccessControlAllowHeaders)
        header(HttpHeaders.ContentType)
        header(HttpHeaders.AccessControlAllowOrigin)
        allowCredentials = true
        allowNonSimpleContentTypes = true
        anyHost()
    }
It worked here @John O'Reilly
Thank you
👍 1