我試圖讓AJAX請求使用下面的代碼下載從S3一個JSON文件:鉻:GET請求取消CORS HTTPS請求
$.ajax({
'type':'GET',
'url':this.baseUrl + publicationId + "/document.json",
'crossDomain': true,
'dataType':'json',
'success':function(data) {
console.log('got document.json');
}
});
這在Firefox罰款,和它的作品,如果的baseUrl爲http:// < S3-URL >,但如果是https://開頭,之後,Chrome取消有錯誤的請求:
XMLHttpRequest cannot load https ://s3.amazonaws.com/<bucket-name>/<pub-id>/document.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https ://localhost.office.lucidpress.com' is therefore not allowed access.
製作的捲曲度相同的請求,確實有以下標題:「 Access-Control-Allow-Origin:*「。
爲什麼這不適用於Chrome,是否有任何解決方法?
注:我在URL中放置空格以防止它們變成鏈接。
那看起來可能是這樣。 S3爲OPTIONS請求提供403。 – Thayne