Nginx Upload Progress Module with Rails and Passen

2019-07-17 08:59发布

问题:

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.

This is the nginx.conf file I have setup: http://pastie.org/835075

Any ideas?

回答1:

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.

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;
}