2014-09-03 73 views
0

我想上傳圖像到finagle(netty)服務器。對於OPTIONS請求我返回以下:CORS請求無效 - 缺少頭文件?

curl -X OPTIONS http://localhost:8686/images -i               
    HTTP/1.1 200 OK 
    Access-Control-Allow-Origin: * 
    Access-Control-Allow-Methods: POST 

瀏覽器(螢火蟲):http://s15.postimg.org/vtdzyfshn/Screen_Shot_2014_09_02_at_9_49_05_PM.png

以下POST請求失敗,

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote 
resource at http://localhost:8686/images. This can be fixed by moving the resource 
to the same domain or enabling CORS. 

螢火1(控制檯):http://s30.postimg.org/9utq4ridt/Screen_Shot_2014_09_02_at_9_53_41_PM.png 螢火2( Net Tab):http://s16.postimg.org/jyblxfcv9/Screen_Shot_2014_09_02_at_9_54_37_PM.png FireBug 3(Net Tab - POST):http://s14.postimg.org/e8czua2wh/Screen_Shot_2014_09_02_at_9_54_47_PM.png

任何想法我失蹤?

(我用這上傳腳本:http://www.extremecss.com/creating-asynchronous-file-upload-system-using-html5-file-api/

+0

您是否正在返回POST響應頭部中的CORS標頭? – Sam 2014-09-03 05:07:07

+0

哦,上帝,我試過了,忘記重新啓動服務器了,我改變了它,它可以正常工作* duh *如果您將此添加爲答案,我會接受! – mmlac 2014-09-03 05:08:30

+0

偶爾會發生在我們所有人身上:) – Sam 2014-09-03 05:12:14

回答

0

你必須返回CORS標頭(訪問控制允許來源:*)響應報頭內到您的文章,而不是內部的OPTIONS響應。