尝试在Google云端存储上列出存储桶内容时无法使CORS正常工作(未找到404)

时间:2014-03-19 20:27:40

标签: google-api

我按照所有说明进行了排查'故障排除' CORS的指南,但我感觉它只是不工作..我花了最近2天只是试图列出一个桶内容而不管我如何为我的桶配置我的CORS它以同样的方式失败

我正在使用的内容:  angularJS客户端应用程序使用本地计算机(即localhost)中的JSON API直接与Google云端存储进行对话

遵循所有建议:

https://developers.google.com/storage/docs/cross-origin

我的水桶: GS:// okrp-dev的

THE ERROR(Chrome最新浏览器) XMLHttpRequest无法加载 https://storage.googleapis.com/storage/v1beta2/b/okrp-dev/o 。 No' Access-Control-Allow-Origin'标头出现在请求的资源上。起源' http://localhost'因此不允许访问。

我的CORS文件现在(虽然我已尝试过其他所有排列): 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>

来自Chrome开发工具网络标签的跟踪:

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

注意我的身份验证工作正常。我不再获得401.只有404。 注意我当然也完全打开了对存储桶和对象的所有权限,这根本没有帮助。

我还能如何解决这个问题?

0 个答案:

没有答案