Skip to content

Commit

Permalink
hotfix: CORS AllowedOrigins 환경 분리 (#136)
Browse files Browse the repository at this point in the history
* hotfix: CORS AllowedOrigins 환경 분리

* hotfix: CORS AllowedOrigins url 범위 변경
  • Loading branch information
char-yb committed Jan 12, 2024
1 parent 4b81ad0 commit fa614fc
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,17 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();

configuration.addAllowedOriginPattern(UrlConstants.PROD_DOMAIN_URL.getValue());

if (!springEnvironmentUtil.isProdProfile()) {
configuration.addAllowedOriginPattern(UrlConstants.LOCAL_DOMAIN_URL.getValue());
switch (springEnvironmentUtil.getCurrentProfile()) {
case "prod":
configuration.addAllowedOriginPattern(UrlConstants.PROD_DOMAIN_URL.getValue());
break;
case "dev":
configuration.addAllowedOriginPattern(UrlConstants.DEV_DOMAIN_URL.getValue());
configuration.addAllowedOriginPattern(UrlConstants.LOCAL_DOMAIN_URL.getValue());
break;
default:
configuration.addAllowedOriginPattern("*");
break;
}

configuration.addAllowedHeader("*");
Expand Down

0 comments on commit fa614fc

Please sign in to comment.