forked from kriasoft/graphql-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-cors.sh
More file actions
executable file
·53 lines (51 loc) · 1.45 KB
/
update-cors.sh
File metadata and controls
executable file
·53 lines (51 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
curl "https://storage.googleapis.com/upload.example.com/?cors" \
--request PUT \
--header "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
--header "Content-Type: application/xml" \
--data @- << EOF
<?xml version='1.0' encoding='UTF-8'?>
<CorsConfig>
<Cors>
<Origins>
<Origin>https://example.com</Origin>
</Origins>
<Methods>
<Method>GET</Method>
<Method>HEAD</Method>
<Method>PUT</Method>
<Method>OPTIONS</Method>
</Methods>
<ResponseHeaders>
<ResponseHeader>Content-Type</ResponseHeader>
<ResponseHeader>Access-Control-Allow-Origin</ResponseHeader>
</ResponseHeaders>
<MaxAgeSec>3600</MaxAgeSec>
</Cors>
</CorsConfig>
EOF
curl "https://storage.googleapis.com/test-upload.example.com/?cors" \
--request PUT \
--header "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
--header "Content-Type: application/xml" \
--data @- << EOF
<?xml version='1.0' encoding='UTF-8'?>
<CorsConfig>
<Cors>
<Origins>
<Origin>*</Origin>
</Origins>
<Methods>
<Method>GET</Method>
<Method>HEAD</Method>
<Method>PUT</Method>
<Method>OPTIONS</Method>
</Methods>
<ResponseHeaders>
<ResponseHeader>Content-Type</ResponseHeader>
<ResponseHeader>Access-Control-Allow-Origin</ResponseHeader>
</ResponseHeaders>
<MaxAgeSec>3600</MaxAgeSec>
</Cors>
</CorsConfig>
EOF