Skip to content

Commit

Permalink
Cors recovery (#95)
Browse files Browse the repository at this point in the history
* feat: cors 해결을 위한 OriginPattern 추가

* fix: OriginPattern 변경

* chore: 주석 추가

* feat: @EnableWebMvc 추가

* chore: 삭제 예정

* feat: CorsConfig 추가
  • Loading branch information
zzawang authored May 30, 2024
1 parent c0e9741 commit da21f86
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions be/issue-tracker/src/main/java/com/issuetracker/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.issuetracker;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

@Configuration
public class CorsConfig {
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}

0 comments on commit da21f86

Please sign in to comment.