Prevent proxying of static assets

0 views
Skip to first unread message

Gary Doades

unread,
Apr 15, 2008, 9:48:26 AM4/15/08
to SwitchPipe
If you can't use rewite rules for some reason, proxying works just
fine. The setup instructions currently state that getting apache to
serve static files is a problem in this case. However, the following
example will prevent proxying of the static assets for a standard
rails application.

Inside a VirtualHost perhaps.....

DocumentRoot "/usr/home/myuser/myapp/public"
ServerName www.myapp.com
ProxyPass /javascripts !
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass / http://127.0.0.1:8080/myapp/
ProxyPassReverse / http://127.0.0.1:8080/myapp/
<Directory "/usr/home/myuser/myapp/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>


This assumes that myapp has been setup on switchpipe that is running
on port 8080

Cheers,
Gary.

Peter Cooper

unread,
Apr 20, 2008, 2:15:00 PM4/20/08
to SwitchPipe


On Apr 15, 2:48 pm, Gary Doades <g...@gpdnet.co.uk> wrote:
> If you can't use rewite rules for some reason, proxying works just
> fine. The setup instructions currently state that getting apache to
> serve static files is a problem in this case. However, the following
> example will prevent proxying of the static assets for a standard
> rails application.

That is a really cool example you've given; thanks! I didn't realize
you could do that with ProxyPass.

Cheers,
Peter Cooper

Gary Doades

unread,
Apr 23, 2008, 3:28:58 PM4/23/08
to SwitchPipe
It just seems simpler than using rewrite rules (to me).

Testing on FreeBSD 7.0 64 bit platform, Xeon 2.33 Mhz dual core, this
arrangement only seems to add about 1ms overhead using Switchpipe as
opposed to just sending the request to a mongrel instance alone.

Using rewrite with .htaccess files uses about twice that. Don't know
if that's the rewrite overhead or having to process .htaccess though.

Cheers,
Gary.

Peter Cooper

unread,
Apr 27, 2008, 7:28:41 PM4/27/08
to SwitchPipe
> Testing on FreeBSD 7.0 64 bit platform, Xeon 2.33 Mhz dual core, this
> arrangement only seems to add about 1ms overhead using Switchpipe as
> opposed to just sending the request to a mongrel instance alone.
>
> Using rewrite with .htaccess files uses about twice that. Don't know
> if that's the rewrite overhead or having to process .htaccess though.

Or both. Even though .htaccess will be in file cache, it'll still add
time, and being prepared to deal with regular expressions will keep
rewrites a little slower too. I will try and update the documentation
with your example for those who are interested :) (Once I play with it
myself, of course - I have something your tips might suit deployed
live now with rewrite rules..)

Cheers,
Pete
Reply all
Reply to author
Forward
0 new messages