七牛跨域上传设置了returnUrl和returnBody,返回的HTTP 代码是303,但被浏览器cancel掉了,why?
PutPolicy putPolicy = new PutPolicy(bucketName);
putPolicy.returnUrl = "http://192.168.1.53:8085/video/videoCallBack.htm";
putPolicy.returnBody = "{\"name\": $(fname),\"size\": \"$(fsize)\",\"key\": $(key), \"hash\": $(etag),\"mimeType\": $(mimeType)}";
String uptoken = putPolicy.token(mac);
return uptoken;
}
去七牛上看过,文件上传是成功了的。
用chrome://net-internals 查看了下请求的信息
t=36694 [st=36623] -HTTP_TRANSACTION_SEND_REQUEST
t=36694 [st=36623] +HTTP_TRANSACTION_READ_HEADERS [dt=742]
t=36694 [st=36623] HTTP_STREAM_PARSER_READ_HEADERS [dt=742]
t=37436 [st=37365] HTTP_TRANSACTION_READ_RESPONSE_HEADERS
--> HTTP/1.1 303 See Other
Server: nginx/1.4.4
Date: Fri, 10 Apr 2015 01:11:47 GMT
Content-Type: text/plain; charset=utf-8
**Content-Length: 0**
Connection: keep-alive
Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size
Access-Control-Allow-Methods: OPTIONS, HEAD, POST
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 2592000
Cache-Control: no-store, no-cache, must-revalidate
**Location: http://XXXXXXX:14600/video/videoCallBack.htm?upload_ret=eyJuYW1lIjogIkplbGx5ZmlzaC5qcGciLCJzaXplIjogIjc3NTcwMiIsImtleSI6ICIxNDI4NjI3NDMwODY4IiwgImhhc2giOiAiRmpzVnZvU3Y4Z3N5S3BQQXVhcW1MaVd0TTdTMCIsIm1pbWVUeXBlIjogImltYWdlL2pwZWcifQ==**
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Log: s.ph;s.put.tw:1;s.put.tr:11;s.put.tw:5;s.put.tr:8;s.ph;s.put.tw:1;s.put.tr:10;s.ph;PFDS:20;PFDS:21;PFDS:21;rs12_8.sel/not found;rs11_8.sel/not found;rdb.g/no such key;DBD/404;DBG/404;v4.sel:1/Document not found;rs12_8.ins;qtbl.ins:3;mc.s;RS:5;rs.put:5;rs-upload.putFile:29;UP:47/303
X-Reqid: NyIAAIiAuXLggdMT
t=37436 [st=37365] -HTTP_TRANSACTION_READ_HEADERS
t=37436 [st=37365] URL_REQUEST_DELEGATE [dt=0]
t=37436 [st=37365] +URL_REQUEST_DELEGATE [dt=31]
t=37436 [st=37365] DELEGATE_INFO [dt=31]
--> delegate_info = "AsyncResourceHandler"
t=37467 [st=37396] -URL_REQUEST_DELEGATE
t=37467 [st=37396] CANCELLED
t=37468 [st=37397] -URL_REQUEST_START_JOB
**--> net_error = -3 (ERR_ABORTED)**
t=37468 [st=37397] URL_REQUEST_DELEGATE [dt=0]
t=37468 [st=37397] -REQUEST_ALIVE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
后来有人解释说是因为flash升级的原因,改用其它的处理方法。
http://segmentfault.com/q/1010000002619532?_ea=169806
回调地址要是一个公网IP,且要有返回数据。