Skip to content

Commit 86aa2ef

Browse files
authored
feat: addCorsMapping method 추가
feat: addCorsMapping method 추가
2 parents 27375f1 + 450fe80 commit 86aa2ef

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/be/dash/dashserver/api/config/WebMvcConfig.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.springframework.context.annotation.Configuration;
55
import org.springframework.format.FormatterRegistry;
66
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
7+
import org.springframework.web.servlet.config.annotation.CorsRegistry;
78
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
89
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
910
import be.dash.dashserver.api.support.MemberIdArgumentResolver;
@@ -45,4 +46,16 @@ public void addInterceptors(InterceptorRegistry registry) {
4546
registry.addInterceptor(permissionInterceptor)
4647
.addPathPatterns("/api/**");
4748
}
49+
50+
@Override
51+
public void addCorsMappings(CorsRegistry registry) {
52+
registry.addMapping("/**")
53+
.allowedOrigins(
54+
"https://stage.da-sh.kr"
55+
)
56+
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
57+
.allowedHeaders("*")
58+
.allowCredentials(true)
59+
.maxAge(3600);
60+
}
4861
}

0 commit comments

Comments
 (0)