# Mod\_proxy\_balancer question

**URL:** <https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900>\
**Category:** Rails\
**Created:** [August 14, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900 "2008-08-14T21:17:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/1 "2008-08-14T21:17:25Z")

</div>

Here’s the problem, I want to start running more mongrels on a 2nd  
server, but I want it so that any file uploads still go to the 1st  
server.

Anyone know how I can do this?

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/2 "2008-08-14T21:53:02Z")

</div>

Hi David,

> Here’s the problem, I want to start running more mongrels on a 2nd  
> server, but I want it so that any file uploads still go to the 1st  
> server.

You’ll need some sort of Layer 7 rules engine to configure that, which  
mod\_proxy\_balancer doesn’t have. Alternatively you could look into using  
some sort of shared storage such as NFS, Samba or GFS.

–  
Roderick van Domburg

> **[De domeinnaam Nedforce.nl is te koop.](http://www.nedforce.nl)**
>
> Deze mooie domeinnaam kan al over een paar minuten van jou zijn. Betalen gaat eenvoudig en vertrouwd via iDEAL. Direct na de betaling ontvang je de verhuiscode per e-mail en kun je aan de slag.

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 10:13pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/3 "2008-08-14T22:13:54Z")

</div>

On Aug 14, 8:53 pm, Roderick van Domburg \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> Hi David,
> 
> > Here’s the problem, I want to start running more mongrels on a 2nd  
> > server, but I want it so that any file uploads still go to the 1st  
> > server.
> 
> You’ll need some sort of Layer 7 rules engine to configure that, which  
> mod\_proxy\_balancer doesn’t have. Alternatively you could look into using  
> some sort of shared storage such as NFS, Samba or GFS.

You can definitely change which mongrels you balance to based on the  
url. I wouldn’t be surprised if you could rewrite based on the content-  
type header (and all file uploads will have the multipart etc content  
type.

Fred

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/4 "2008-08-14T22:42:14Z")

</div>

> You can definitely change which mongrels you balance to based on the  
> url. I wouldn’t be surprised if you could rewrite based on the content-  
> type header (and all file uploads will have the multipart etc content  
> type.
> 
> Fred

Yeah the URL would be enough, there’s only one action that handles file  
uploads. Can you give me any pointers on this, what would I need to  
write in the conf file?

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 11:04pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/5 "2008-08-14T23:04:54Z")

</div>

On Aug 14, 9:42 pm, David F. \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> > You can definitely change which mongrels you balance to based on the  
> > url. I wouldn’t be surprised if you could rewrite based on the content-  
> > type header (and all file uploads will have the multipart etc content  
> > type.
> 
> > Fred
> 
> Yeah the URL would be enough, there’s only one action that handles file  
> uploads. Can you give me any pointers on this, what would I need to  
> write in the conf file?

our vhost has got something like

RewriteRule ^/admin/._$ balancer://admin\_cluster%{REQUEST\_URI}  
[P,QSA,L]  
RewriteRule ^/report/._$ balancer://admin\_cluster%{REQUEST\_URI}  
[P,QSA,L]

# All other URLs should be served by the texpert cluster

RewriteRule ^/.\*$ balancer://main\_cluster%{REQUEST\_URI} [P,QSA,L]

urls starting with /admin and /report go the the admin\_cluster, and  
the others to the main\_cluster.

Fred

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/6 "2008-08-14T23:19:59Z")

</div>

> our vhost has got something like
> 
> RewriteRule ^/admin/._$ balancer://admin\_cluster%{REQUEST\_URI}  
> [P,QSA,L]  
> RewriteRule ^/report/._$ balancer://admin\_cluster%{REQUEST\_URI}  
> [P,QSA,L]
> 
> # All other URLs should be served by the texpert cluster
> 
> RewriteRule ^/.\*$ balancer://main\_cluster%{REQUEST\_URI} [P,QSA,L]
> 
> urls starting with /admin and /report go the the admin\_cluster, and  
> the others to the main\_cluster.
> 
> Fred

That looks perfect, I’ll give it a go.

Thanks Fred!

---

<div class="post-metadata">

**Author:** ![davidf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f07891/32.png) [@davidf](https://www.ruby-forum.com/u/davidf)\
**Post date:** [August 14, 2008, 11:07pm UTC](https://www.ruby-forum.com/t/mod-proxy-balancer-question/145900/7 "2008-08-14T23:07:04Z")

</div>

Hi David,

> > You can definitely change which mongrels you balance to based on the  
> > url. I wouldn’t be surprised if you could rewrite based on the content-  
> > type header (and all file uploads will have the multipart etc content  
> > type.
> 
> Yeah the URL would be enough, there’s only one action that handles file  
> uploads. Can you give me any pointers on this, what would I need to  
> write in the conf file?

Frederick is right – thanks for making me read up on my mod\_proxy  
knowledge! I was under the assumption that this required more expensive  
hardware balancing, so this is cool.

Check out the ProxyPass directives at the mod\_proxy documentation at  
[mod\_proxy - Apache HTTP Server Version 2.2](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html). It’s got ample  
examples.

–  
Roderick van Domburg

> **[De domeinnaam Nedforce.nl is te koop.](http://www.nedforce.nl)**
>
> Deze mooie domeinnaam kan al over een paar minuten van jou zijn. Betalen gaat eenvoudig en vertrouwd via iDEAL. Direct na de betaling ontvang je de verhuiscode per e-mail en kun je aan de slag.
