I followed all the instructions and troubleshooting guide for CORS, but I feel like it just doesn't work. I spent the last 2 days just trying to list the contents of the bucket, and it doesn't matter how setting up my CORS for my bucket doesn't work the same.
What I use:
An angularJS client application directly connected to Google cloud storage using the JSON API from my local computer (i.e. localhost)
Follow all the tips here:
https://developers.google.com/storage/docs/cross-origin
My bucket:
gf: // okrp-dev
ERROR (latest Chrome browser)
XMLHttpRequest cannot load https://storage.googleapis.com/storage/v1beta2/b/okrp-dev/o . The requested resource does not have an Access-Control-Allow-Origin header. Origin 'is therefore not allowed. http://localhost
My CORS file is now (although I tried every other permutation):
bash -3.2 $ gsutil cors get gs: // okrp-dev
<?xml version="1.0" ?>
<CorsConfig>
<Cors>
<Origins>
<Origin>*</Origin>
<Origin>
http://localhost</Origin>
</Origins>
<Methods>
<Method>GET</Method>
<Method>POST</Method>
<Method>HEAD</Method>
</Methods>
<ResponseHeaders>
<ResponseHeader>*</ResponseHeader>
</ResponseHeaders>
<MaxAgeSec>86400</MaxAgeSec>
</Cors>
</CorsConfig>
Tracing from the Chrome Developer Tools. Network Tab:
Remote Address:74.125.193.132:443
Request URL:https://storage.googleapis.com/storage/v1beta2/b/okrp-dev/o
Request Method:OPTIONS
Status Code:200 OK
Request Headers
:host:
storage.googleapis.com
:method:OPTIONS
:path: /storage/v1beta2/b/okrp-dev/o
:scheme:https
:version:
HTTP/1.1
accept:*/*
accept-encoding:
gzip,deflate,sdch
accept-language:en-US,en;q=0.8,tr;q=0.6
access-control-request-headers:access-control-allow-origin, accept, authentication
access-control-request-method:GET
cache-control:
no-cache
origin:
http://localhost
pragma:
no-cache
referer:http://localhost/okrp/app/
Response Headersview source
alternate-protocol:443:quic
cache-control:
private, max-age=0
content-length:0
content-type:
text/html; charset=UTF-8
server:HTTP Upload Server Built on Mar 5 2014 15:51:04 (1394063464)
status:200 OK
version:
HTTP/1.1
NOTE Authentication works fine for me. I no longer get 401. Only 404.
NOTE I, of course, also fully opened all permissions on the bucket and object, and this does not help at all.
How else can I fix this problem?