Response to preflight request doesn't pass access control check

后端 未结 21 2124
别那么骄傲
别那么骄傲 2020-11-22 03:50

I\'m getting this error using ngResource to call a REST API on Amazon Web Services:

XMLHttpRequest cannot load http://server.apiurl.com:8000/s/login

21条回答
  •  有刺的猬
    2020-11-22 04:27

    I am using AWS sdk for uploads, after spending some time searching online i stumbled upon this thread. thanks to @lsimoneau 45581857 it turns out the exact same thing was happening. I simply pointed my request Url to the region on my bucket by attaching the region option and it worked.

     const s3 = new AWS.S3({
     accessKeyId: config.awsAccessKeyID,
     secretAccessKey: config.awsSecretAccessKey,
     region: 'eu-west-2'  // add region here });
    

提交回复
热议问题