Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ended up getting this to work, albeit with nginx &amp; unicorn rather than Apache &amp; Passenger.</p> <p>As you pointed out in <a href="https://github.com/rtomayko/rack-cache/issues/41" rel="nofollow">your Github issue</a>, you can switch Rack::Cache back to use it's standard file:/ store rather than the rails:/ store, which will allow the responses to respond to <code>to_path</code>.</p> <pre><code>config.action_dispatch.rack_cache = { :verbose =&gt; true, :metastore =&gt; URI.encode("file:/PATH/TO/CACHE/STORE"), :entitystore =&gt; URI.encode("file:/PATH/TO/CACHE/STORE") } </code></pre> <p>Dragonfly does this in development, and you can still do it in production if you like. The caveat with doing this is if you use any of the Rails caching features that use Rack::Cache, the cache entries will be stored in that store rather than the standard Rails one so you'll need to account for that if you need to clear any of those entries manually.</p> <p>You then also need to make sure that you insert the Rack::Sendfile middleware at the front of the stack with the config.action_dispatch.x_sendfile_header argument. Without the config argument, Rack::Sendfile wont add the header.</p> <pre><code>config.middleware.insert 0, Rack::Sendfile, config.action_dispatch.x_sendfile_header </code></pre> <p><a href="https://gist.github.com/3731110" rel="nofollow">My Gist</a> shows my relevant lines in production.rb and my nginx template. Should be easily adapted to work with the Apache X-Sendfile module.</p> <p>One other thing to note if you're testing this, is that if you only send a HEAD request via cURL for example, you will not get the relevant X-Sendfile header in the response as Rack::Cache wont actually send the body for a HEAD request and so Rack::Sendfile has nothing to call <code>to_path</code> on.</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.
    1. VO
      singulars
      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