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()) { with(CorsConfiguration()) {
applyPermitDefaultValues() applyPermitDefaultValues()
allowedOrigins = environment["twigs.cors.domains"]?.split(",") ?: listOf("*") allowedOrigins = environment["twigs.cors.domains"]?.split(",") ?: listOf("*")
allowedMethods = listOf(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE) allowedMethods = listOf(
.map { it.name } HttpMethod.GET,
HttpMethod.POST,
HttpMethod.PUT,
HttpMethod.DELETE,
HttpMethod.OPTIONS
).map { it.name }
allowCredentials = true allowCredentials = true
this this
} }