AngularJS performs an OPTIONS HTTP request for a cross-origin resource

后端 未结 14 1340
生来不讨喜
生来不讨喜 2020-11-22 03:04

I\'m trying to setup AngularJS to communicate with a cross-origin resource where the asset host which delivers my template files is on a different domain and therefore the X

14条回答
  •  伪装坚强ぢ
    2020-11-22 03:09

    Your service must answer an OPTIONS request with headers like these:

    Access-Control-Allow-Origin: [the same origin from the request]
    Access-Control-Allow-Methods: GET, POST, PUT
    Access-Control-Allow-Headers: [the same ACCESS-CONTROL-REQUEST-HEADERS from request]
    

    Here is a good doc: http://www.html5rocks.com/en/tutorials/cors/#toc-adding-cors-support-to-the-server

提交回复
热议问题