Skip to content

Commit

Permalink
Feat: WebConfig 작성
Browse files Browse the repository at this point in the history
- cors 설정 추가
  • Loading branch information
don9m1n committed Mar 22, 2024
1 parent 91ed0c0 commit fd0550b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/com/api/readinglog/common/web/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.api.readinglog.common.web;

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) {
// TODO: cors 설정 좀 더 다듬기
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedHeaders("*")
.allowedMethods("*")
.exposedHeaders("*")
.allowCredentials(true)
.maxAge(3600); // 캐싱
}
}

0 comments on commit fd0550b

Please sign in to comment.