Skip to content

Commit

Permalink
✨ fix: cors origin 수정
Browse files Browse the repository at this point in the history
preflight 요청에 대한 캐시 저장 기간을 설정하고 헤더에 "Access-Control-Allow-Origin"을 추가했습니다.
  • Loading branch information
dlrjs2360 committed Dec 26, 2023
1 parent 2483830 commit bb0f3dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/HowBaChu/howbachu/config/CorsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(true);
.allowedOriginPatterns("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600L);
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/HowBaChu/howbachu/jwt/JwtFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public void doFilterInternal(HttpServletRequest request, HttpServletResponse res
resolveTokenFromCookie(request, REFRESH_TOKEN_HEADER),
request, response);

response.setHeader("Access-Control-Allow-Origin", "*");

chain.doFilter(request, response);

}
Expand Down

0 comments on commit bb0f3dc

Please sign in to comment.