Access-Control-Allow-Origin added to firebase.json but missing from the file response header

你说的曾经没有我的故事 提交于 2019-12-10 16:01:47

问题


Below is my simple firebase.json. If I read the docs right it should tag all files with 'Access-Control-Allow-Origin'. Unfortunately none of the files are being tagged resulting in the error:

Imported resource from origin 'https://gaspush.firebaseapp.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Could someone take a look and let me know how to properly allow all files to all endpoints?

{
  "firebase": "gaspush",
  "headers": [ {
    "source" : “**”,
    "headers" : [ {
      "key" : "Access-Control-Allow-Origin",
      "value" : "*"
    } ]
  } ],
  "public": ".",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ]
}

回答1:


This is maybe no longer relevant to the original question, but I ran into a similar issue with the new version of Firebase. I had accidentally placed "headers" section outside of the "hosting" key. The below snippet worked for me.

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



来源:https://stackoverflow.com/questions/30927956/access-control-allow-origin-added-to-firebase-json-but-missing-from-the-file-res

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