2016-05-17 65 views
0

我以前发布this question关于如何从azure搜索中提取索引架构。获取索引Azure搜索失败'预检的响应具有无效的HTTP状态代码403'

我能够通过使用GET Index REST API使用邮差,没有任何问题,但在浏览器中运行我的代码时,我得到的错误拉的索引架构:

XMLHttpRequest cannot load https://[service name].search.windows.net/indexes/[index name]?api-version=[api-version] Response for preflight has invalid HTTP status code 403

我只是运行在控制台以下代码:

$.ajax({ url: 'https://[service name].search.windows.net/indexes/[index name]?api-version=[api-version]', type: 'GET', datatype: 'json', headers: {'api-key': [api-key]}})

然而,这个代码工作正常(返回所有数据 - 唯一的区别是/docs):

$.ajax({ url: 'https://[service name].search.windows.net/indexes/[index name]/docs?api-version=[api-version]', type: 'GET', datatype: 'json', headers: {'api-key': [api-key]}})

另一个奇怪的是,对于GET请求指数请求头不显示API密钥。

看起来像CORS(它在Azure搜索上设置为'*'),不喜欢浏览器对GET索引的请求吗?

任何帮助将受到欢迎。

+0

可能的重复[jQuery的Ajax - 从本地主机生成没有'访问控制允许来源'标头](http://stackoverflow.com/questions/37127195/jquery-ajax-post-from-localhost-generates -no-access-control-allow-origin-hea) –

回答

3

Azure搜索不支持管理级别的操作,例如CORS请求中的获取索引。见this related answer

+0

谢谢......那就是我一直在寻找的东西。 – chrissavage

相关问题