Website
website: https://esgtool-extention.netlify.app/
Problem Description
Due to no https support, I must post a http request to API on http://www.esgcraftgame.com/api.php/. I find that it is not allowed. After seaching, the only way is to add a proxy by _redirects file. But I still failed, and the request return following. It seen has used the proxy, but still failed.
Mixed Content: The page at 'https://esgtool-extention.netlify.app/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.esgcraftgame.com/api.php/user/login/index'. This request has been blocked; the content must be served over HTTPS.
Can you please help me?
My Config
- _redirects file
/esg/api/* http://www.esgcraftgame.com/api.php/:splat
/baidu/* https://www.baidu.com/:splat
- post request on “测试按钮” button
var FormData = require('form-data');
var data = new FormData();
data.append('app_key', '123456789');
data.append('token', '');
data.append('address', this.address);
var config = {
method: 'post',
url: '/esg/api/user/login/index',
data: data
};
console.log("测试按钮结果")
console.log(config);
const token = axios(config)
.then(function (response) {
console.log(response);
return response;
})
.catch(function (error) {
console.log(error);
});
return token;
}
- Error
esgtool-extention.netlify.app/:1 Mixed Content: The page at 'https://esgtool-extention.netlify.app/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.esgcraftgame.com/api.php/user/login/index'. This request has been blocked; the content must be served over HTTPS.