Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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/**"
  ]
}
like image 795
Spencer Easton Avatar asked Jun 19 '15 00:06

Spencer Easton


1 Answers

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" : "*"
        }]
    }]
  }
like image 172
Andrew Serong Avatar answered Oct 20 '22 07:10

Andrew Serong