2014-09-03 177 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响应。