Skip to content

Commit

Permalink
Chore: cors 설정을 추가한다.
Browse files Browse the repository at this point in the history
Chore: cors 설정을 추가한다.
  • Loading branch information
hseong3243 authored Feb 5, 2024
2 parents 68b457d + c8bc920 commit b9fac61
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

Expand All @@ -30,4 +31,12 @@ public void addInterceptors(InterceptorRegistry registry) {
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
resolvers.add(new LoginUserArgumentResolver(authenticationContext));
}

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins("http://localhost:3000", "https://shoutlink.me")
.allowedMethods("GET", "POST", "PATCH", "DELETE", "OPTIONS")
.allowCredentials(true);
}
}

0 comments on commit b9fac61

Please sign in to comment.