mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-10-26 04:22:38 +00:00
[F] Fix CORS
This commit is contained in:
parent
a8f5380070
commit
3039a32f29
@ -6,10 +6,22 @@ import org.springframework.security.config.Customizer
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
|
||||
import org.springframework.security.web.SecurityFilterChain
|
||||
import org.springframework.web.cors.CorsConfiguration
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
class SecurityConfig() {
|
||||
class SecurityConfig {
|
||||
@Bean
|
||||
fun corsConfigurationSource() = UrlBasedCorsConfigurationSource().apply {
|
||||
registerCorsConfiguration("/api/**", CorsConfiguration().apply {
|
||||
allowedOrigins = listOf("*")
|
||||
allowedMethods = listOf("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
allowedHeaders = listOf("*")
|
||||
})
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun configure(http: HttpSecurity): SecurityFilterChain = http
|
||||
.headers { it.disable() }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user