Firebase is using the same storage infrastructure as google cloud .
1. Go to https://console.cloud.google.com and select the dashboard of the project that contains the firebase storage.
2. On the top right, there will be a button named "Activate Cloud Shell", click on it, a terminal will open on the bottom of the page
Click on Open Editor
Click on File, and New file.
3.Create new file with name cors.json, paste the following save.
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
4.On your Firebase Console and select "Storage" and get your storage bucket URL (e.g gs://
)
5.Then open the terminal again and paste following
gsutil cors set cors.json gs://<your-cloud-storage-bucket>
The CORS error should be gone for Storage for which we added the configuration. It wont be applied to other storage bucket
0 comments:
Post a Comment