Skip to content

Commit

Permalink
Merge pull request #142 from Troth-Cam/feat/public
Browse files Browse the repository at this point in the history
Feat/public
  • Loading branch information
aeeazip authored Aug 16, 2023
2 parents b7cd68d + e4cc18a commit d90c4c0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/trothly/trothcam/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package trothly.trothcam.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:8080/","http://localhost:3000/", "https://trothly.com/") // 허용할 출처
.allowedMethods("GET", "POST", "DELETE", "PATCH", "PUT") // 허용할 HTTP method
.allowCredentials(true) // 쿠키 인증 요청 허용
.maxAge(3000); // 원하는 시간만큼 pre-flight 리퀘스트를 캐싱
}
}

0 comments on commit d90c4c0

Please sign in to comment.