Skip to content

Commit

Permalink
🚀 Merge pull request #51 from local-mood/fix/50-cors-allowed-origins
Browse files Browse the repository at this point in the history
Fix: CORS allowed-origins 추가
  • Loading branch information
gmkim20713 authored Dec 23, 2023
2 parents f9f28b9 + 59f5eb3 commit b5a33bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/ceos/vote/common/config/CorsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
public class CorsConfig {

@Value("${domain}")
private String domain;
private String clientUrl;

@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin(domain);
config.addAllowedOrigin("http://localhost:3000");
config.addAllowedOrigin(clientUrl);
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**",config);
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ springdoc:
swagger-ui:
path: /swagger-vote.html

domain: ENC(wtMoW4E5IOZgq215uWHzGsBlrqecbyNr9lsrql5da0LFtz4cywsN8Fap3bhNqVYQ0RuvblLIewQZo+u8pBCaFA==)
clientUrl: ENC(xZJ/NyHwyN5VEY3W6Btq++gSySY0VzGxn9iJuP25Wj3vmwGsulhgRQ==)

0 comments on commit b5a33bc

Please sign in to comment.