Skip to content

Commit

Permalink
[BE] feat: CORS를 설정하다 (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
70825 authored Aug 1, 2023
1 parent 2a64086 commit 827a7d6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/src/main/java/com/funeat/common/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.HttpHeaders;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
Expand All @@ -29,4 +31,12 @@ public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
resolvers.add(customPageableHandlerMethodArgumentResolver);
resolvers.add(authArgumentResolver);
}

@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("*")
.exposedHeaders(HttpHeaders.LOCATION);
}
}

0 comments on commit 827a7d6

Please sign in to comment.