Skip to content

Commit

Permalink
🐛fix : cors 설정변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkYunHo committed Aug 20, 2023
1 parent ee7e996 commit c87191f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions api/src/main/kotlin/com/john/lotto/config/WebFluxConfig.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
package com.john.lotto.config

import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpMethod
import org.springframework.web.reactive.config.CorsRegistry
import org.springframework.web.reactive.config.EnableWebFlux
import org.springframework.web.reactive.config.WebFluxConfigurer

/**
* @author yoonho
* @since 2023.06.22
* @since 2023.08.20
*/
@Configuration
@EnableWebFlux
class WebFluxConfig: WebFluxConfigurer {

override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/webjars/**")
.allowedOrigins("http://localhost:8080")
.allowedMethods("GET", "POST")
registry.addMapping("/**")
.allowedOrigins("*")
.allowedHeaders("*")
.allowedMethods(
HttpMethod.GET.name(),
HttpMethod.POST.name(),
HttpMethod.DELETE.name(),
HttpMethod.HEAD.name(),
)
}
}

0 comments on commit c87191f

Please sign in to comment.