Note that there are some explanatory texts on larger screens.

plurals
  1. POServing dynamic zip files through Apache
    primarykey
    data
    text
    <p>One of the responsibilities of my Rails application is to create and serve signed xmls. Any signed xml, once created, never changes. So I store every xml in the <code>public</code> folder and redirect the client appropriately to avoid unnecessary processing from the controller.</p> <p>Now I want a new feature: every xml is associated with a date, and I'd like to implement the ability to serve a compressed file containing every xml whose date lies in a period specified by the client. Nevertheless, the period cannot be limited to less than one month for the feature to be useful, and this implies some zip files being served will be as big as 50M.</p> <p>My application is deployed as a Passenger module of Apache. Thus, it's totally unacceptable to serve the file with <a href="http://api.rubyonrails.org/classes/ActionController/Streaming.html#method-i-send_data" rel="nofollow"><code>send_data</code></a>, since the client will have to wait for the entire compressed file to be generated before the actual download begins. Although I have an idea on how to implement the feature in Rails so the compressed file is produced <em>while being served</em>, I feel my server will get scarce on resources once some lengthy Ruby/Passenger processes are allocated to serve big zip files.</p> <p>I've read about <a href="http://www.therailsway.com/2009/2/22/file-downloads-done-right" rel="nofollow">a better solution</a> to serve static files through Apache, but not dynamic ones.</p> <p>So, what's the solution to the problem? Do I need something like a custom Apache handler? How do I inform Apache, from my application, how to handle the request, compressing the files and streaming the result simultaneously?</p>
    singulars
    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.
 

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