Skip to content

Commit

Permalink
Dev에 allowed-origins에 localhost:3000을 추가 (#318)
Browse files Browse the repository at this point in the history
refactor: Allowed-Orgins 수정
  • Loading branch information
cookienc authored Aug 11, 2023
1 parent 3ad7f10 commit 6888e91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/baton/secret
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpHeaders.LOCATION;
import static org.springframework.http.HttpMethod.DELETE;
Expand All @@ -18,12 +20,14 @@
public class WebMvcConfig implements WebMvcConfigurer {

@Value("${cors.allowed-origin}")
private String allowedOrigin;
private List<String> origins;

@Override
public void addCorsMappings(final CorsRegistry registry) {
final String[] allowedOrigins = origins.toArray(String[]::new);

registry.addMapping("/**")
.allowedOrigins(allowedOrigin)
.allowedOrigins(allowedOrigins)
.allowCredentials(true)
.allowedMethods(GET.name(), POST.name(), PUT.name(), PATCH.name(), DELETE.name(), OPTIONS.name())
.exposedHeaders(LOCATION, AUTHORIZATION)
Expand Down

0 comments on commit 6888e91

Please sign in to comment.