Skip to content

Commit

Permalink
fix : (#29) cors...
Browse files Browse the repository at this point in the history
  • Loading branch information
coehgns committed Feb 14, 2025
1 parent 27e9b2d commit fac1b57
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource
class CorsConfig {
@Bean
fun corsConfigurationSource(): CorsConfigurationSource {
val configuration = CorsConfiguration()
configuration.allowedOrigins = listOf("*")
configuration.allowedMethods = listOf("GET", "POST", "PUT", "DELETE", "OPTIONS")
configuration.allowedHeaders = listOf("*")
configuration.allowCredentials = false
val configuration = CorsConfiguration().apply {
allowedOrigins = listOf(
"http://localhost:5173",
"http://localhost:3000"
)
allowedMethods = listOf("*")
allowCredentials = true
addAllowedHeader("*")
allowedHeaders = listOf("*")
}

val source = UrlBasedCorsConfigurationSource()
source.registerCorsConfiguration("/**", configuration)
return source
return UrlBasedCorsConfigurationSource().apply {
registerCorsConfiguration("/**", configuration)
}
}
}

0 comments on commit fac1b57

Please sign in to comment.