Mailing List Archive

ProxyPass question
Hello,

I have a site which is completelly dynamic (everything mod_perl)
I want to use mod_proxy+mod_perl setup so that mod_proxy serves all
the images and proxies dynamic content to mod_perl server.
Furthermore, all images reside in /pics directory (i.e.
http://the.site.com/pics/logo.gif),
and I _really_ do not want to change this.

Here is a problem I ran into:
I have the following lines in httpd.conf file to proxy dynamic content to
mod_perl
ProxyPass / http://my_backend_server/
ProxyPassReverse / http://my_backend_server/

I cannot find a way to make mod_proxy server handle pics. I tried
Alias /pics/ "/some/dir/", AliasMatch, and god knows what else...nothing
worked

It seems that ProxyPass kicks in before any other uri transitions happen...

Any ideas or suggestions would be greatly appreciated.

Thanks.

--
Eugene Miretskiy <eugene@invision.net>
InVision.com, INC. (516) 543-1000
www.invision.net / www.longisland.com
Re: ProxyPass question [ In reply to ]
On Tue, 15 Feb 2000, Eugene Miretskiy wrote:

> I have a site which is completelly dynamic (everything mod_perl)
> I want to use mod_proxy+mod_perl setup so that mod_proxy serves all
> the images and proxies dynamic content to mod_perl server.
> Furthermore, all images reside in /pics directory (i.e.
> http://the.site.com/pics/logo.gif),
> and I _really_ do not want to change this.
>
> Here is a problem I ran into:
> I have the following lines in httpd.conf file to proxy dynamic content to
> mod_perl
> ProxyPass / http://my_backend_server/
> ProxyPassReverse / http://my_backend_server/
>
> I cannot find a way to make mod_proxy server handle pics. I tried

Rewrite to the rescue!

RewriteLogLevel 1
RewriteLog "| /usr/local/apache_proxy/bin/rotatelogs /usr/local/apache-common/logs/r_log 86400"

<VirtualHost 0.0.0.0>

RewriteEngine on
RewriteOptions inherit
RewriteRule (^.+\.(mtpl|tmpl|mpl|cgi)$) http://your.backend.com$1 [P]

</VirtualHost>

--
-- Tom Mornini
-- InfoMania Printing and Prepress
Re: ProxyPass question [ In reply to ]
>>>>> "EM" == Eugene Miretskiy <eugene@invision.net> writes:

EM> Here is a problem I ran into:
EM> I have the following lines in httpd.conf file to proxy dynamic content to
EM> mod_perl
EM> ProxyPass / http://my_backend_server/
EM> ProxyPassReverse / http://my_backend_server/

What you want to do is something like this:

RewriteEngine On
# handle GIF and JPG images, traditional CGI's directly
RewriteRule \.(gif|jpg|png|css|txt|cgi)$ - [last]
RewriteRule ^/cgi-bin - [last]
# pass off everything but images to the heavy-weight server via proxy
RewriteRule ^/(.*)$ http://localhost:4077/$1 [proxy]

That is, first, handle locally what you want to handle locally, then
hand off everything else to the back-end guy.
Re: ProxyPass question [ In reply to ]
Thank you VERY much.
I've been struggling with this problem for quite a while.
Yesterday I tried using mod_rewrite, but I guess I lack experience there.
I tried your suggestion -- works like a charm.

Thanks a lot.


Vivek Khera wrote:
>
> >>>>> "EM" == Eugene Miretskiy <eugene@invision.net> writes:
>
> EM> Here is a problem I ran into:
> EM> I have the following lines in httpd.conf file to proxy dynamic content to
> EM> mod_perl
> EM> ProxyPass / http://my_backend_server/
> EM> ProxyPassReverse / http://my_backend_server/
>
> What you want to do is something like this:
>
> RewriteEngine On
> # handle GIF and JPG images, traditional CGI's directly
> RewriteRule \.(gif|jpg|png|css|txt|cgi)$ - [last]
> RewriteRule ^/cgi-bin - [last]
> # pass off everything but images to the heavy-weight server via proxy
> RewriteRule ^/(.*)$ http://localhost:4077/$1 [proxy]
>
> That is, first, handle locally what you want to handle locally, then
> hand off everything else to the back-end guy.

--
Eugene Miretskiy <eugene@invision.net>
InVision.com, INC. (516) 543-1000
www.invision.net / www.longisland.com