-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Co-due/feature/issue9
[#9]deploy: CORS 설정 reactive 방식으로 수정
- Loading branch information
Showing
2 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/soma/haeya/edupi_gateway/config/CorsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package soma.haeya.edupi_gateway.config; | ||
|
||
import java.util.List; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
import org.springframework.web.cors.reactive.CorsConfigurationSource; | ||
import org.springframework.web.cors.reactive.CorsWebFilter; | ||
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; | ||
|
||
@Configuration | ||
public class CorsConfig { | ||
|
||
@Bean | ||
public CorsWebFilter corsWebFilter() { | ||
return new CorsWebFilter(corsConfigurationSource()); | ||
} | ||
|
||
@Bean | ||
public CorsConfigurationSource corsConfigurationSource() { | ||
CorsConfiguration configuration = new CorsConfiguration(); | ||
configuration.setAllowedOrigins(List.of("*")); | ||
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); | ||
configuration.setAllowedHeaders(List.of("*")); | ||
configuration.setAllowCredentials(true); | ||
configuration.setMaxAge(3600L); | ||
|
||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
source.registerCorsConfiguration("/**", configuration); | ||
|
||
return source; | ||
} | ||
|
||
} |
18 changes: 0 additions & 18 deletions
18
src/main/java/soma/haeya/edupi_gateway/config/SecurityConfig.java
This file was deleted.
Oops, something went wrong.