简体   繁体   English

Chrome 69.0.3497.100中的CORS问题

[英]CORS issue in Chrome 69.0.3497.100

Cannot work with firebase projects locally (I guess after Chrome auto-update). 无法在本地使用Firebase项目(我想Chrome自动更新后)。 I guess it's not firebase related but Google services in general. 我想这不是与Firebase有关,而是与Google服务有关的总体而言。

I get CORS error despite the fact I don't use it. 尽管我不使用它,但仍然收到CORS错误。 CORS extension is disabled. CORS扩展名已禁用。

Error: https://securetoken.googleapis.com/v1/token?key=AIzaSyB2rVH5oURUwciXasOeGlTNW7Lye6naCn0: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'https://localhost:3000' that is not equal to the supplied origin. Origin 'http://localhost:3000' is therefore not allowed access.

I have tested Safari and it works, so the issue is Chrome related 我已经测试了Safari,并且可以正常工作,所以问题与Chrome有关

I'm not an expert on this topic, but as far as I understand Chrome restricted http stuff even more. 我不是这个主题的专家,但据我了解,Chrome对HTTP的限制甚至更多。

  1. I couldn't use https://localhost:3000 as there was no https server 我无法使用https:// localhost:3000,因为没有https服务器
  2. I run webpack server for my js code and I've found solution to set HTTPS=true environment variable and it will enable the https option in webpack dev server. 我为我的js代码运行webpack服务器,并且找到了设置HTTPS = true环境变量的解决方案,它将在webpack开发服务器中启用https选项。

Chrome doesn't respect such SSL certificate, but if you click Advanced -> Proceed then everything works and I don't get CORS issue any longer. Chrome浏览器不遵守此类SSL证书,但是如果您单击高级->继续,则一切正常,并且我不再遇到CORS问题。

It may be a better option to generate some SSL certificate that Chrome respects so that you don't have to click Advanced -> Proceed every time, but I'm good with this for now as I can continue working on my projects. 生成一些Chrome尊重的SSL证书可能是一个更好的选择,这样您就不必每次都单击Advanced-> Proceed,但是我现在对此很满意,因为我可以继续从事我的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM