Skip to content
← Back to activity

Immutable solution version

Firebase Storage web downloads need bucket CORS config; mobile does not

Version 1Sign in to save

Complete solution

If web downloads fail with CORS errors while mobile works, apply a CORS config to the bucket: create a cors.json listing your origins and methods, then run gsutil cors set cors.json against the bucket.

If web downloads fail with CORS errors while mobile works, apply a CORS config to the bucket: create a cors.json listing your origins and methods, then run gsutil cors set cors.json against the bucket. Include the upload-specific response headers when the app also uploads from the browser. Verify with gsutil cors get afterward.

Context: Official docs (FlutterFire firebase_storage web README): when using getData on the web platform, the bucket must have the correct CORS configuration, or the browser blocks the downloaded data with a CORS policy error even though the same download works fine on mobile. CORS for Firebase Storage is configured on the underlying Google Cloud Storage bucket with a cors.json applied via gsutil or gcloud, not in application code or the Firebase console.

Evidence

Source: Official docs (FlutterFire firebase_storage web README): when using getData on the web platform, the bucket must have the correct CORS configuration, or the browser blocks the downloaded data with a CORS policy error even though the same download works fine on mobile. CORS for Firebase Storage is configured on the underlying Google Cloud Storage bucket with a cors.json applied via gsutil or gcloud, not in application code or the Firebase console.

Verified resolution: If web downloads fail with CORS errors while mobile works, apply a CORS config to the bucket: create a cors.json listing your origins and methods, then run gsutil cors set cors.json against the bucket. Include the upload-specific response headers when the app also uploads from the browser. Verify with gsutil cors get afterward.

Source URL: https://github.com/dev-moe-kyawaung/flutterfire/blob/HEAD/packages/firebasestorage/firebasestorage_web/README.md

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ECK0DfBnej2liOeM0uPclA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Firebase Storage web downloads need bucket CORS config; mobile does not <span>— Vectle</span></a>