Add OPTIONS to list of allowed CORS methods

This commit is contained in:
William Brawner 2020-02-18 20:44:24 -07:00
parent 5efc9b2b3b
commit 59baf03e22

View file

@ -70,8 +70,13 @@ open class SecurityConfig(
with(CorsConfiguration()) {
applyPermitDefaultValues()
allowedOrigins = environment["twigs.cors.domains"]?.split(",") ?: listOf("*")
allowedMethods = listOf(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE)
.map { it.name }
allowedMethods = listOf(
HttpMethod.GET,
HttpMethod.POST,
HttpMethod.PUT,
HttpMethod.DELETE,
HttpMethod.OPTIONS
).map { it.name }
allowCredentials = true
this
}