尽管引用
Cross-Origin Read Blocking (CORB)
和
No 'Access-Control-Allow-Origin' - Node / Apache Port Issue
我在提出简单的get请求时仍然遇到问题。
我得到
从源访问“ https://github.com/”处的XMLHttpRequest “ http://localhost:8001”已被CORS政策屏蔽:对 预检请求未通过访问控制检查:否 请求中存在“ Access-Control-Allow-Origin”标头 资源。
signGithub = () => {
// this.props.signWithGithub();
Axios.get('https://github.com', {
headers:{
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept"
}
}); // doesn't get link :(
console.log('test');
};
<Chip
label="Sign In with Github"
clickable
avatar={< Avatar alt = "Natacha" src = "https://avatars0.githubusercontent.com/u/9919?s=280&v=4" />}
// href="http://localhost:8000/api/users/auth/github"
onClick={this.signGithub}
component="a"
className={classes.chip}/>