从浏览器直接将图像上传到Cloudinary,响应302

tom*_*199 6 cors cloudinary preflight

我按照nodejs示例项目(https://github.com/cloudinary/cloudinary_npm/tree/master/samples)开发一个简单的Web应用程序,允许用户上传他们的个人资料图片.当我尝试直接从浏览器上传图像时,我收到错误消息,其中列出了以下消息:

XMLHttpRequest cannot load https://api.cloudinary.com/v1_1/mycloudname/auto/upload. The request was redirected to 'http://localhost:3000/cloudinary_cors.html?bytes=411&created_at=2015-11-23T…s=%23%3CSet%3A0x0000000c75f2e0%3E&type=upload&version=1448287679&width=175', which is disallowed for cross-origin requests that require preflight.
Run Code Online (Sandbox Code Playgroud)

如上所述,问题可能是由于我的节点服务器上的cors支持,所以我回到我的服务器代码并确保回调可以找到cloudinary_cors.html.我再次运行测试,但仍然遇到同样的错误.我设法找到了从控制台上传照片的OPTIONS和POST请求,POST请求返回302(请查找附加的响应消息以供参考),但是可以在Cloudinary仪表板上找到该图像.我怎么能解决这个问题?任何输入将不胜感激!

Remote Address:23.23.xxx.xxx:443 
Request URL:https://api.cloudinary.com/v1_1/mycloudname/auto/upload 
Request Method:POST 
Status Code:302 Found 
Response Headers 
view source 
Access-Control-Allow-Methods:POST, GET, OPTIONS 
Access-Control-Allow-Origin:http://localhost:3000 
Access-Control-Max-Age:1728000 
Cache-Control:no-cache 
Connection:keep-alive 
Content-Length:840 
Content-Type:text/html; charset=utf-8 
Date:Mon, 23 Nov 2015 14:07:59 GMT 
Location:http://localhost:3000/cloudinary_cors.html?bytes=411&created_at=2015-11-23T14%3A07%3A59Z&delete_token=04963d1a6e5957ee8179c67879c0bc59241f7875fa3a29f430ee7ed942509ea7e0a302627a3b4927ea1cddb2ce2a4028e98d8130b363fdb27901c55a1edb0e9c73e88b027598f3ed1fcc55111ec618d5747d2a16ce80c4036b35d2b778ee81964e2c9014c5e4d796a04b0106f607b9af9bae058c76f4643ccbccaa4fda81968d4728427dfa0ae398fa8322c3760bee45e232336b0464fd0233313d082945e63878d137ddd98e77db9088b6835df8c0905e9e109e3df1add8da50c8b895e503b7&am...
Server:cloudinary 
Status:302 Found 
X-Request-Id:5dae5c1d34551a10 
X-UA-Compatible:IE=Edge,chrome=1 
Request Headers 
view source 
Accept:*/* 
Accept-Encoding:gzip, deflate 
Accept-Language:en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4 
Connection:keep-alive 
Content-Length:1197 
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Host:api.cloudinary.com 
Origin:http://localhost:3000 
Referer:http://localhost:3000/users/1234567 
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36 
Request Payload 
------WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Content-Disposition: form-data; name="timestamp"

1448287672 
------WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Content-Disposition: form-data; name="callback"

http://localhost:3000/cloudinary_cors.html 
------WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Content-Disposition: form-data; name="return_delete_token"

1 
------WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Content-Disposition: form-data; name="signature"

19f131b28f7da0bca1e78bf8b0820abc8653206e 
------WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Content-Disposition: form-data; name="api_key"

367827361899815 
------WebKitFormBoundaryhrzAgVFkPZMRAPo9 
Content-Disposition: form-data; name="file"; filename="default_qrcode.png" 
Content-Type: image/png

------WebKitFormBoundaryhrzAgVFkPZMRAPo9--
Run Code Online (Sandbox Code Playgroud)