如何修复"混合内容:"从反应中对elasticsearch进行API调用时出错

时间:2018-04-07 06:58:24

标签: firebase elasticsearch axios create-react-app mixed-content

我正在使用来自firebase的bitnami版本的elasticsearch。我发现当我使用邮递员尝试时,它只会连接到http而不是https。我的create-react-app已部署到firebase,当我尝试使用Mixed Content:库获取数据时出现axios错误。

这里是我的代码:

import axios from 'axios';

axios.get('http://xx.xxx.xx.xxx//elasticsearch/tasks/task/_search?default_operator=AND&q=*', {
    httpsAgent: agent,
    method: 'get',
    headers: {
        // 'Content-Type': 'application/json',
        'Authorization': 'Basic xxxxxxxxxx='
    }
});

和错误

Mixed Content: The page at 'https://xxx-xxxx.firebaseapp.com/tasks' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://xx.xxx.xx.xxx//elasticsearch/tasks/task/_search?default_operator=AND&q=*'. This content should also be served over HTTPS.

0 个答案:

没有答案