Response to preflight request doesn't pass access control check

后端 未结 21 2436
别那么骄傲
别那么骄傲 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:18

    It's easy to solve this issue just with few steps easily,without worrying about anything. Kindly,Follow the steps to solve it .

    1. open (https://www.npmjs.com/package/cors#enabling-cors-pre-flight)
    2. go to installation and copy the command npm install cors to install via node terminal
    3. go to Simple Usage (Enable All CORS Requests) by scrolling.then copy and paste the complete declartion in ur project and run it...that will work for sure.. copy the comment code and paste in ur app.js or any other project and give a try ..this will work.this will unlock every cross origin resource sharing..so we can switch between serves for your use

提交回复
热议问题