[Mongrel] Uploading Large (100mb+) files

cremes.devlist at mac.com cremes.devlist at mac.com
Tue Nov 28 14:05:12 EST 2006


On Nov 28, 2006, at 11:40 AM, Rogelio J. Samour wrote:

> I have an Apache 2.2.3 (mod_proxy_balancer) frontend server that does
> not have mongrel installed. It does proxy requests to several other
> mongrel-only servers (each running 2 mongrel processes). Each mongrel
> node has the same rails code-base and it's working perfectly.
>
> However, my question is when I add an upload file form... where is it
> going to physically put that file? I mean since it's hitting either  
> one
> node or the other, so how does mongrel deal with that? and how or  
> where
> do I tell it to accept large files (100mb+) ?
>
> I have read on having an upload-only mongrel process, but again how  
> will
> all the other mongrels know to post the file to it or to a specific
> folder somewhere? Direction on this would be greatly appreciated!
>
> Thanks for your help on this. I searched the forum and didn't find
> anything specifically dealing with this. I have also checked the  
> mongrel
> docs and most of the setups talk about mongrel_upload_progress plugin
> and/or the mongrel_cluster setup...(I may have missed something :-/)

I'm starting work on a way for Mongrel to better handle really large  
file uploads (20+ MB).

In the meantime, it's still pretty easy to setup a dedicated mongrel  
instance for file uploads.

Assuming you are using mod_proxy_balancer, you first need to setup an  
exception for it.

For example, the balancer setup lines look like this:

ProxyPass / balancer://mongrel_cluster/
ProxyPassReverse / balancer://mongrel_cluster

Put an exception line before the first call to ProxyPass like so:

ProxyPass /uploads ! # proxy will not rewrite if it contains this URI

Then, further down in your Apache configuration file, put in a  
rewrite rule to send the connection to the mongrel dedicated to uploads:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/uploads.*
RewriteRule .*             http://example.com:some_port% 
{REQUEST_URI}  [P,QSA,L]

(That RewriteRule is untested but should work.) There are probably  
other ways to skin this particular cat.

cr


More information about the Mongrel-users mailing list