【问题标题】:Calling Azure function from Angular 1.6, CORS problems从 Angular 1.6 调用 Azure 函数,CORS 问题
【发布时间】:2018-04-23 21:02:21
【问题描述】:

我正在尝试调用我的 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 设置。首先通过指定我的确切域。然后在允许的来源列表中添加* 作为最后一个条目。

但错误信息仍然存在。

我做错了什么?

【问题讨论】:

    标签: angularjs cors azure-functions


    【解决方案1】:

    原来我就是看不懂说明书。

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

    【讨论】:

    • 如您所见,Access-Control-Allow_Origin 响应标头只能采用 单个 值 - *Origin 请求标头的确切值。任何其他值都会导致您看到的错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-13
    • 2019-02-21
    • 2019-11-28
    • 2017-06-20
    • 2019-02-05
    • 2015-08-23
    • 2020-06-21
    相关资源
    最近更新 更多