Setting Up CORS for Firebase Storage
Firebase Storage needs CORS permissions set up if you ever want to use XHR or Fetch APIs in the browser to request files from it. However, this isn't easily available via Firebase's web interface. Instead, configuration needs to be done via the Google Cloud SDK and
To make things easier, use Google's Web Shell which has everything installed and configured.
- Go to https://ssh.cloud.google.com/cloudshell/editor
- Choose the correct project.
- Create a
cors.jsonfile with the following (change as needed):
- Run the following (change
gsutil cors set cors.json gs://PROJECT_ID.appspot.com
That's about it. It's strange that Firebase doesn't have this process available on its web interface. Maybe it will, one day.
Thanks for reading.