반응형
Spring 에서 CORS 설정을 하고 보니 아래와 같은 에러가 발생하였다.
CORS에 대한 내용은 아래 참고 포스팅 참고 바란다.
When allowCredentials is true, allowedOrigins cannot contain the special value "*"
since that cannot be set on the "Access-Control-Allow-Origin" response header.
To allow credentials to a set of origins, list them explicitly or consider
using "allowedOriginPatterns" instead.
원인
스프링부트 버전 2.4.0부터 allowedOrigins에 “*“을 추가할 수 없고 allowedOrigins는 특정 도메인만 받을 수 있다.
해결방안
.allowedOrigins 대신 .allowedOriginPatterns를 사용해야 한다.
allowedOriginPatterns는 “*“같은 와일드카드를 사용할 수 있다.
참고 포스팅
https://thenicesj.tistory.com/329
CORS 란?
한가지 극단적인 예를 들어본다면, 만약 어떤 악성 프로그램이 당신의 컴퓨터에 설치가 되고 해당 프로그램을 통해서 브라우저에서 특정 명령을 수행한다면 어떻게 될까? 로그인이 세션으로 잡
thenicesj.tistory.com
반응형
댓글