서버와 통신할 때 credentials: 'include' 설정을 했을 경우

response header의 Access-Control-Allow-Origin: '*' 설정은 사용 할 수 없다.

url을 ,로 연결해도 소용 없다.

서버에서 request header로 들어온 origin을 그대로 반환해 주면 된다.

'*'와 같은 효과가 나는데 보안상 안좋아서 하지 말라는 것이니

whitelist목록을 만들어 놓고 origin이 포함되면 그대로 돌려주게 하면 된다.

node module중 cors에 origin 설정도 이런 식으로 이루어진다.

 

'nodeJS > http transaction' 카테고리의 다른 글

Chrome cookie Policy: SameSite  (0) 2020.02.19
nodeJs http file transfer  (0) 2019.04.25

errorMessage
Resolution method is overspecified. Specify a callback or return a Promise; not both.

it('test method', async done =>
   request(app).get('/version')
       .expect(200, done)
  )```

'done' is used for async test;
but must not be use with async

'nodeJS' 카테고리의 다른 글

axios vs fetch #1  (0) 2019.11.17
npm 설치 가능한 버전 보기  (0) 2019.08.16
Conflicts in NextJs and Routing-Controllers  (0) 2019.07.30
또 다른 circular dependency 처리  (0) 2019.04.09
nodeJs 구조  (0) 2018.04.18

+ Recent posts