Skip to content

Commit

Permalink
!hotfix: CORS 설정변경
Browse files Browse the repository at this point in the history
  • Loading branch information
kimday0326 committed May 30, 2024
1 parent f85a0c3 commit a1749c1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/khu/gitbox/auth/config/WebMvcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Configuration
@RequiredArgsConstructor
public class WebMvcConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
log.info("CORS 설정 적용");
registry.addMapping("/**")
.allowedOrigins(getAllowOrigins())
.allowedHeaders("*")
Expand All @@ -23,7 +26,9 @@ public void addCorsMappings(CorsRegistry registry) {

private String[] getAllowOrigins() {
return Arrays.asList(
"http://localhost",
"http://localhost:3000",
"http://localhost:1234",
"http://localhost:5173",
"http://125.250.17.196:1234"
).toArray(String[]::new);
Expand Down

0 comments on commit a1749c1

Please sign in to comment.