1. JSON 파일 준비
example.json
[{
"origin": ["*"],
"responseHeader": [
"Content-Type",
"Access-Control-Allow-Origin",
"x-goog-resumable"
],
method: ["PUT", "GET", "HEAD", "DELETE", "POST", "OPTIONS"],
"maxAgeSeconds": 3600
}]
위 예시는 모든 출처 도메인을 허용하고, 모든 HTTP 메소드를 허용하는 CORS 설정입니다.
2. GCP 콘솔에 명령어 입력
gcloud storage buckets update gs://BUCKET_NAME --cors-file=example.json
3. 설정 확인
gcloud storage buckets describe gs://BUCKET_NAME
4. 설정 삭제
gcloud storage buckets update gs://BUCKET_NAME --clear-cors
참고
https://cloud.google.com/storage/docs/using-cors?hl=ko#command-line
https://cloud.google.com/storage/docs/cors-configurations?hl=ko
'Cloud > GCP' 카테고리의 다른 글
GCP GKE 클러스터 시작/중지 자동화 (0) | 2023.04.11 |
---|---|
GCS 서명된 URL로 파일 업로드(JavaScript) (0) | 2023.03.20 |
[GCP] Cloud CDN을 위한 서명된 URL 만들기(JavaScript) (0) | 2023.03.17 |
GCS 버킷 서명된 URL 만들기(NodeJS) (0) | 2023.03.17 |
GCS 버킷에 Cloud CDN 적용하기 (0) | 2023.02.01 |