Py学习  »  Elasticsearch

离子+firebase+elasticsearch无法使用elasticsearch.js进行身份验证

Marat Tynarbekov • 4 年前 • 346 次点击  
const client = new elasticsearch.Client({
  host: [
    {
      host: '35.192.45.130//elasticsearch',
      auth: 'user:password',
      protocol: 'http',
      port: 80
    }
  ]
});
//

await client.ping({
  // ping usually has a 3000ms timeout
  requestTimeout: 1000
}, function (error) {
  if (error) {
    console.trace('elasticsearch cluster is down!');
  } else {
    console.log('All is well');
  }
});

我不能授权用离子进行弹性搜索。但是有了邮递员,我已经可以登录并做一些操作了。

错误是

对飞行前请求的响应未通过访问控制检查:请求的资源上不存在“访问控制允许来源”头。起源 http://localhost:8100 因此不允许访问。响应的HTTP状态代码为401。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/37958
 
346 次点击  
文章 [ 1 ]  |  最新文章 4 年前
Omurbek Kadyrbekov
Reply   •   1 楼
Omurbek Kadyrbekov    5 年前

解决方案是启用 科斯 在浏览器中使用 this plugin 在Chrome浏览器中。

更多关于CORS here