Skip to content

Commit

Permalink
#469 [feat] CORS 허용 범위 수정
Browse files Browse the repository at this point in the history
#469 [feat] CORS 허용 범위 수정
  • Loading branch information
sohyundoh authored Aug 13, 2024
2 parents a899e4b + e217e5a commit 437c3b0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion module-api/src/main/java/com/mile/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.mile.common.resolver.topic.TopicVariableResolver;
import com.mile.common.resolver.user.UserIdHeaderResolver;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
Expand All @@ -28,11 +29,18 @@ public class WebConfig implements WebMvcConfigurer {
private final DuplicatedInterceptor duplicatedInterceptor;
private final UserIdHeaderResolver userIdHeaderResolver;

@Value("${client.local}")
private String clientLocal;

@Value("${client.deploy}")
private String clientDeploy;

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedOrigins(clientLocal, clientDeploy)
.allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS")
.allowCredentials(true)
.maxAge(3000);
}

Expand Down

0 comments on commit 437c3b0

Please sign in to comment.