andylamax
01/19/2021, 11:07 AMinstall(CORS) {
method(HttpMethod.Options)
method(HttpMethod.Patch)
method(HttpMethod.Delete)
header(HttpHeaders.XForwardedProto)
anyHost()
header(AccessControlAllowOrigin)
header(AccessControlAllowMethods)
header(AccessControlAllowCredentials)
header(AccessControlAllowHeaders)
header(AccessControlRequestMethod)
header(AccessControlRequestHeaders)
header(AccessControlExposeHeaders)
header(AccessControlMaxAge)
allowCredentials = true
maxAgeInSeconds = 1000
allowNonSimpleContentTypes = true
}
But I still get this, when I run on the browser. What am I doing wrong? All I need is this request to work
Access to fetch at '<http://192.168.43.218:9010/v1/authorization/user-roles/all>' from origin '<http://localhost:8080>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Currently on: ktor 1.4.3
Kotlin: 1.4.21Jose A.
01/19/2021, 11:26 AMJose A.
01/19/2021, 11:27 AMinstall(CORS) {
method(HttpMethod.Options)
method(HttpMethod.Get)
method(<http://HttpMethod.Post|HttpMethod.Post>)
method(HttpMethod.Put)
method(HttpMethod.Delete)
header(HttpHeaders.AccessControlAllowHeaders)
header(HttpHeaders.ContentType)
header(HttpHeaders.AccessControlAllowOrigin)
header(HttpHeaders.Authorization)
anyHost()
allowCredentials = true
allowNonSimpleContentTypes = true
}
I'm using thisandylamax
01/19/2021, 11:27 AMGet
and Post
where added by defaultandylamax
01/19/2021, 11:27 AMJose A.
01/19/2021, 11:28 AMheader(HttpHeaders.Authorization)
This one is important tooandylamax
01/19/2021, 11:29 AMandylamax
01/19/2021, 11:30 AMJose A.
01/19/2021, 11:33 AMandylamax
01/19/2021, 12:14 PMandylamax
01/19/2021, 12:14 PMJose A.
01/19/2021, 12:34 PM