使用IE11签名的网址不起作用

时间:2014-09-10 11:53:10

标签: php google-cloud-storage internet-explorer-11

即。版本11.0.9431.0

我无法从IE11上传文件到谷歌云存储,我能够从firefox上传相同的代码同样的文件,它显示我没有启用CORS的错误,但我已经启用了谷歌云端的CORS存储

我设定的CORS是:

[
  {
    "origin": ["*"],
    "responseHeader": ["accept-encoding", "cache-control", "content-length", "content-type",     "expect", "if-modified-since", "origin", "range", "referer", "x-goog-acl", "x-goog-api-version"],
    "method": ["GET","PUT","HEAD","OPTIONS"],
    "maxAgeSeconds": 900
  }
]

Error on console that I get on IE11 is:

SEC7118: XMLHttpRequest for https://storage.googleapis.com/buckethha/file.jpg?GoogleAccessId=748853424295-p1es6br4fmi7ub4gd3junmu6n4fbcr0j@developer.gserviceaccount.com&Expires=1410349523&Signature=ImoOVE0XUBPOfCzMGrNXG0W1P1xJE80Jyee5gD%2FMcCp0uTxVf9GdMTayNESFw4qslrcDMMjU1otI4O4s15pMx9g136uEWnVkDrLc3hN6LGcnFpd1VuV9cjB%2BewnuHs3AqVJYH9PCKXNCkl%2FR%2Bwwm4rrKOjz3KApAAZblCzEeoFE%3D required Cross Origin Resource Sharing (CORS).File: UploadSignedUrlPut.php
SEC7119: XMLHttpRequest for https://storage.googleapis.com/buckethha/file.jpg?GoogleAccessId=748853424295-p1es6br4fmi7ub4gd3junmu6n4fbcr0j@developer.gserviceaccount.com&Expires=1410349523&Signature=ImoOVE0XUBPOfCzMGrNXG0W1P1xJE80Jyee5gD%2FMcCp0uTxVf9GdMTayNESFw4qslrcDMMjU1otI4O4s15pMx9g136uEWnVkDrLc3hN6LGcnFpd1VuV9cjB%2BewnuHs3AqVJYH9PCKXNCkl%2FR%2Bwwm4rrKOjz3KApAAZblCzEeoFE%3D required CORS preflight.File: UploadSignedUrlPut.php

我的HTML-php代码是 - > http://pastebin.com/qCkT1mr8

注意:我应该在代码中添加什么或要求解决此问题? IE 9,10和11是官方支持我的应用程序的浏览器,所以我必须以某种方式解决这个问题

1 个答案:

答案 0 :(得分:0)

仔细观察后,我发现了I.E.中显示的警告。并没有指出我正确的方向,实际问题是,当使用PUT上传文件时,firefox正在发送带有请求的内容类型,这就是为什么我的签名与Google匹配,而且IE没有明确发送,所以添加它已解决了我的问题

i.e. 
xhr.setRequestHeader("Content-Type", file.type);