从Angular 1.6调用Azure函数,CORS问题

时间:2018-04-23 12:31:28

标签: angularjs cors azure-functions

我试图调用我的Azure功能,但失败了:

$http.post(url, {data: data, headers: headers})
  .success(function (jSendResponse, status, headers) {
    console.warn("worked");
  })
  .error(function (errResponse) {
    console.warn('failed')
  });

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<Origin domain>' is therefore not allowed access. The response had HTTP status code 400.

我更改了此特定Azure功能的CORS设置。首先指定我的确切域名。然后将*添加为允许来源列表中的最后一个条目。

但错误信息仍然存在。

我做错了什么?

1 个答案:

答案 0 :(得分:1)

事实证明我无法阅读说明书。

使用*通配符时,必须从列表中删除所有其他域(我只能假设我用于特定域的条目不正确,或者通过代理以不同方式路由)。