Skip to content

Commit

Permalink
Chore: Chrome Extension Second Cors 설정 추가 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChooSeoyeon authored Sep 2, 2023
1 parent 68806ea commit 94a3ce3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ public class CorsConfig {

@Value("${chrome.extension.id}")
private String extensionId;
@Value("${chrome.extension.id.second}")
private String extensionIdSecond;

@Bean
public CorsFilter corsFilter() {

System.out.println(extensionId);

CorsConfiguration configuration = new CorsConfiguration();
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

configuration.setAllowCredentials(true); // 내 서버가 응답을 할 때 json을 자바스크립트에서 처리할 수 있게 할지를 설정하는 것
configuration.addAllowedOrigin("http://localhost:3000");
configuration.addAllowedOrigin("chrome-extension://" + extensionId);
configuration.addAllowedOrigin("chrome-extension://" + extensionIdSecond);

configuration.addAllowedHeader("*"); // 모든 header에 응답을 허용
configuration.addAllowedMethod("*"); // 모든 post, get, put, delete, patch 요청을 허용

Expand Down

0 comments on commit 94a3ce3

Please sign in to comment.