我想通過AJAX發送文件到rackspace。這是我第一次看CORS。我的文檔中看到發送預檢要求的選項,但是因爲我個人設置的頭,我知道自己的起源是有效的,我想放棄,這些都是從我的上傳端點標題:CORS請求立即取消鉻
HTTP/1.1 204 No Content
Content-Length: 0
X-Container-Object-Count: 2
Accept-Ranges: bytes
X-Container-Meta-Access-Log-Delivery: false
X-Container-Meta-Access-Control-Expose-Headers: etag location x-timestamp x-trans-id
X-Timestamp: 1401852621.29287
X-Container-Meta-Access-Control-Allow-Origin: h ttp://localhost:8080**<-- (manually added the space after "h" so stackoverflow would let me submit)
X-Container-Bytes-Used: 5572910
Content-Type: text/plain; charset=utf-8
X-Trans-Id: txfc64055cb1114b6fb0ef6-0053a77a46ord1
Date: Mon, 23 Jun 2014 00:52:22 GMT
但是,每當我嘗試發送鍍鉻它立即失敗,出現以下消息的請求:
XMLHttpRequest cannot load [**I'm redacting my actual endpoint**]. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'h ttp://localhost:8080' is therefore not allowed access.
這裏是我的請求頭:
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryZSg4nEq8EDaXQQBu
Origin:h ttp://localhost:8080
Referer:h ttp://localhost:8080/tools/artwork
<-- (manually added the space after "h" so stackoverflow would let me submit)
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36
我是什麼錯誤唱?即使您知道原產地被允許,是否需要預檢請求?我從來沒有看到一個包回來,似乎Chrome不發送?
http://stackoverflow.com/questions/10883211/deadly-cors-when-http-localhost-is-the-origin – epascarello