How to get external data without CORS headers with Firebase hosted webapp?

烈酒焚心 提交于 2019-12-01 20:52:39

The Firebase docs have an example of setting the Access-Control-Allow-Origin in your firebase.json to allow cross-origin requests for font files. You could adjust that like this:

"headers": [ {
  "source" : "**",
  "headers" : [ {
    "key" : "Access-Control-Allow-Origin",
    "value" : "*"
  } ]
}

That will allow cross-origin requests for all resources. Of course if you want to restrict it to specific resources, you can adjust the source value.

This is probably not a firebase related issue. Your api needs to send CORS in header. Either accept all(*) or your specific firebase hosted app. Easy fix for API written in .net See link https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/enabling-cross-origin-requests-in-web-api

Header set Access-Control-Allow-Origin "*" adding on server htaccess file solve my problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!