Skip to content

Instantly share code, notes, and snippets.

@ricardoleme
Created November 8, 2023 23:57
Show Gist options
  • Save ricardoleme/3b1c21645ed092235b6f70aea2181c77 to your computer and use it in GitHub Desktop.
Save ricardoleme/3b1c21645ed092235b6f70aea2181c77 to your computer and use it in GitHub Desktop.
Set up CORS for Google Cloud Storage Bucket
#Para listar o Bucket name:
gsutil ls
#Definindo as regras de acesso
echo '[{"origin": ["*"],"responseHeader": ["Content-Type"],"method": ["GET", "HEAD"],"maxAgeSeconds": 3600}]' > cors-config.json
#Setando as configurações no Bucket
gsutil cors set cors-config.json gs://YOUR_BUCKET_NAME
#Visualizando as configurações
gsutil cors get gs://YOUR_BUCKET_NAME
@ricardoleme
Copy link
Author

rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if request.method == "GET";
allow write: if request.auth != null;
match /clientes/{imageName} {
allow read;
}
match /imagens/{imageName} {
allow read;
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment