Nginx带有Rails和Passenger的上传进度模块 [英] Nginx Upload Progress Module with Rails and Passenger
问题描述
我一直在尝试使Nginx上传进度模块在Rails和Passenger的WebFaction上运行(使用回形针上传到S3).到目前为止,我得出的最好结果是它在开始和结束时报告,但在此之间没有任何报告.对/progress路径的Ajax请求工作正常.
I’ve been trying to get the Nginx upload progress module running on WebFaction with Rails and Passenger (using Paperclip to upload to S3). The best result I have come up with so far are that it reports on start and on finish, but nothing in between. The Ajax request to the /progress path is working fine.
这是我已设置的nginx.conf文件: http://pastie.org/835075
This is the nginx.conf file I have setup: http://pastie.org/835075
有什么想法吗?
推荐答案
XHR请求在中间说什么?如果显示开始",我将通过更改nginx.conf中指令的顺序来解决它,尽管您的指令看起来与我的相同.
What does the XHR request say midstream? If it says "starting" I solved it by changing the order of directives in the nginx.conf, though yours looks the same as mine.
一旦这样做,它就发送了JSON数据,我发现jQuery 1.4不支持格式错误的JSON数据.我添加了upload_progress_json_output指令以确保格式正确的JSON.
Once I did that, it sent the JSON data, I found out jQuery 1.4 does not honor malformed JSON data. I added the upload_progress_json_output directive to ensure well-formed JSON.
location ^~ /progress {
upload_progress_json_output;
report_uploads proxied;
}
这篇关于Nginx带有Rails和Passenger的上传进度模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!