Skip to content

Commit

Permalink
fix: cors 설정 제거 (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitchannn authored Feb 29, 2024
1 parent 201d8ea commit 005e39a
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions server/src/main/java/sunflower/server/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
package sunflower.server.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

private static final String[] ALLOWED_ORIGINS = {"**"};

@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins(ALLOWED_ORIGINS)
.allowedMethods(
HttpMethod.GET.name(),
HttpMethod.POST.name(),
HttpMethod.PUT.name(),
HttpMethod.PATCH.name(),
HttpMethod.DELETE.name(),
HttpMethod.OPTIONS.name()
)
.allowedHeaders("*")
.exposedHeaders("Location")
.allowCredentials(true);
}
// private static final String[] ALLOWED_ORIGINS = {"**"};
//
// @Override
// public void addCorsMappings(final CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedOrigins(ALLOWED_ORIGINS)
// .allowedMethods(
// HttpMethod.GET.name(),
// HttpMethod.POST.name(),
// HttpMethod.PUT.name(),
// HttpMethod.PATCH.name(),
// HttpMethod.DELETE.name(),
// HttpMethod.OPTIONS.name()
// )
// .allowedHeaders("*")
// .exposedHeaders("Location")
// .allowCredentials(true);
// }
}

0 comments on commit 005e39a

Please sign in to comment.