Note that there are some explanatory texts on larger screens.

plurals
  1. PORails3+Nginx: Serving files with send_file (m4v)
    primarykey
    data
    text
    <p>I use Rails3 with Nginx. </p> <p>I serve files through controller:uploads action.</p> <pre><code>class BannersController &lt; ApplicationController ... # authentication def uploads send_file '{localFilePath}', :disposition =&gt; 'inline' end end </code></pre> <p>I uncomment this line</p> <pre><code>config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx </code></pre> <p>in environments/production.rb.</p> <p>I also defined a mime type 'm4v' inside my initializers/mime_types.rb</p> <pre><code>Mime::Type.register "video/mp4", :m4v MIME::Types.add(MIME::Type.from_array("video/mp4", %(m4v))) </code></pre> <p>My nginx configuration looks like this</p> <pre><code>http { ... # ruby-1.9.3-p0 include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; server { client_max_body_size 30M; listen 80; server_name ... root ... passenger_enabled on; rails_env production; location ~ ^/(assets)/ { root ... gzip_static on; expires max; add_header Cache-Control public; } } } </code></pre> <p>When I request a video file http://{ip}/components/{id}/content/host_bg.m4v file I see errors in my chrome console (single request produces 4 lines) <img src="https://i.stack.imgur.com/VyEsh.png" alt="enter image description here"></p> <p>How can I fix that? I guess my nginx configuration is not complete. Note that I can play video but it is not served as expected (e.g. javascript HTML5 jPlayer can play the video only once then it stops, the repeat works from other http locations). Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload