Response to preflight request doesn't pass access control check

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

    If you are using IIS server by chance. you can set below headers in the HTTP request headers option.

    Access-Control-Allow-Origin:*
    Access-Control-Allow-Methods: 'HEAD, GET, POST, PUT, PATCH, DELETE'
    Access-Control-Allow-Headers: 'Origin, Content-Type, X-Auth-Token';
    

    with this all post, get etc., will work fine.

提交回复
热议问题