반응형
- SCG에서 CORS 관련 "globalcors" 속성으로 cors 설정 가능
spring:
cloud:
gateway:
globalcors:
corsConfigurations:
'[/**]':
allowedOrigins: "*"
allow-credentials: false
allowedHeaders: "*"
allowedMethods: "*"
- CORS 설정 중에 아래와 같은 header contains multiple values 에러 발생 시
Access to XMLHttpRequest at ' https://XXX' from origin 'https://YYY' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values ' https://YYY, https://YYY', but only one is allowed.
"default-filters" RETAIN_UNIQUE 설정 추가
spring:
cloud:
gateway:
default-filters:
- DedupeResponseHeader=Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_UNIQUE
globalcors:
corsConfigurations:
'[/**]':
allowedOrigins: "http://localhost:8089"
allow-credentials: true
allowedHeaders: "*"
allowedMethods: "*"
반응형
'개발 > SpringCloud' 카테고리의 다른 글
Spring Cloud Gateway(SCG) - HelloWorld (0) | 2022.01.28 |
---|
댓글