Error: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

Viewed 7415

I requests s3 server through axios, and I got Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Also, before that, I got OPTIONS https://s3.ap-northeast-2.amazonaws.com/.../... 403 (Forbidden)

I should solve this problem in client-side. I am hosting my files on my local machine. My request codes are below.

axios({
  url: 'https://s3.ap-northeast-2.amazonaws.com/.../...',
  method: 'get',
  withCredentials: true,
  headers: {
    'Content-Type': 'image/jpeg',
    'Access-Control-Allow-Origin': 'http://*, https://*',
  }

})

I tried

  1. start chrome --disable-web-security using git
  2. Installed chrome plugin - Allow-Control-Allow-Origin: *

nothing worked... How can I solve this problem?

1 Answers
Related