Skip to content

Commit

Permalink
hotfix: CORS 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seonghoo1217 committed Jul 17, 2024
1 parent fa6edc8 commit 20a7410
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/jungle/HandTris/global/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public WebMvcConfigurer corsConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000", "https://handtris.vercel.app")
.allowedOrigins("http://localhost:3000", "https://handtris.vercel.app", "https://handtris-jungle.vercel.app")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")
.allowedHeaders("content-type", "Authorization", "Authorization-Refresh", "x-requested-with")
.exposedHeaders("Set-Cookie")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import jungle.HandTris.application.service.CustomOAuth2MemberService;
import jungle.HandTris.global.filter.JWTFilter;
import jungle.HandTris.global.handler.*;
import jungle.HandTris.global.handler.JWTAccessDeniedHandler;
import jungle.HandTris.global.handler.JWTAuthenticateDeniedHandler;
import jungle.HandTris.global.handler.OAuth2FailureHandler;
import jungle.HandTris.global.handler.OAuth2SuccessHandler;
import jungle.HandTris.global.jwt.JWTUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -72,7 +75,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "https://handtris.vercel.app"));
configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "https://handtris.vercel.app", "https://handtris-jungle.vercel.app"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
configuration.setAllowedHeaders(Arrays.asList("content-type", "Authorization", "Authorization-Refresh", "x-requested-with"));
configuration.setAllowCredentials(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void configureMessageBroker(MessageBrokerRegistry config) {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
// WebSocket 엔드포인트를 등록하고 SockJS를 활성화합니다.
registry.addEndpoint("/ws").setAllowedOrigins("http://localhost:3000", "https://handtris.vercel.app").withSockJS();
registry.addEndpoint("/ws").setAllowedOrigins("http://localhost:3000", "https://handtris.vercel.app", "https://handtris-jungle.vercel.app").withSockJS();
}

@Override
Expand Down

0 comments on commit 20a7410

Please sign in to comment.