0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

gsutil で firebase storage へのCORS設定

Posted at

概要

FEなどからStorageへのURLへGETリクエストを許可するためのCORS設定です。

コマンド

適宜どのoriginを許可するか設定

cors.json
[
  {
    "origin": ["*"],
    "method": ["GET"],
    "maxAgeSeconds": 3600
  }
]

gsutil コマンドでstorage bucket にcorsを設定

gsutil cors set cors.json gs://<your-cloud-storage-bucket>

gsutil update がリジェクトされたら

does not have storage.buckets.update access to the Google Cloud Storage bucket. Permission 'storage.buckets.update' denied on resource

と出たら、firebase のサービスアカウント(xxx.jsonで吐き出されるクレデンシャル)をダウンロードして、

gcloud auth activate-service-account --key-file=xxx.json

としてからもう一度gsutil update

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?