在Angular 5中,当通过 http.get()
**?**访问远程资源时,关于CORS,我需要考虑什么
示例:
let url = `http://www.google.com`;
this.http.get(url).subscribe(res => {
console.log(res.text());
// parse html
});
结果:
Failed to load https://www.google.com/:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access.
core.js:1350 ERROR
使用Angular和Firebase生态系统,有没有推荐的方法来解决这个问题?例如,我可以使用云函数通过Node.js访问远程url吗?开发人员通常是如何解决这个问题的?
https://stackoverflow.com/questions/51573357
复制相似问题