CORS Settings

If you want to enable file previewing in the app, you'll have to tweak your bucket's CORS settings.
Here's how:

  1. Go to the Firebase Console, Click on Storage and copy your bucket's URL. firebase-copy-bucket

  2. Go to Google Cloud Console.

  3. You'll see a terminal window pop up. Click on + and select your project from the list. gcp-console

  4. First, paste this in the terminal window and press enter:

rm cors.json
echo "[ { \"origin\": [\"\"], \"method\": [\"GET\"], \"maxAgeSeconds\": 3600 } ]" >> cors.json
  1. Then replace <your-bucket-url> with the bucket URL you copied at step 1 and then paste this in the terminal to enable CORS for your bucket:
gsutil cors set cors.json <your-bucket-url>

NOTE: Change the origin URL if you are using a self-hosted Firefiles instance.

If you want to edit your CORS configuration, you can always click on the Open Editor button which will list your cors.json file in a code editor. From there, you can edit and save your changes. Once you're done, you again need to execute this command to apply your changes:
gsutil cors set cors.json <your-bucket-url> gcp-open-editor