Re: Transparent front-end proxying for many VirtualHosts

2003-03-07 Thread Ask Bjoern Hansen
On Wed, 5 Mar 2003, Andrew Ho wrote:

> I want to simplify my configuration in two ways. I'd prefer not to
> maintain two sets of VirtualHost configuration data, and I'd like it if
> the block that proxies .pl files to the backend proxy not be replicated
> per VirtualHost.

With the details you provided the best advice, as others have given,
is mod_macro or making the httpd.conf from a template.  I usually do
the latter.

If you added more details, for example a sample httpd.conf for the
proxy and the backend it would be easier to help.

Do you use 2.0 for the proxy?
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypreservehost
is often helpful.

"RewriteOptions inherit" might also help simplify your configuration.

> The conceptual behavior I want, is for  to be proxied
> by the backend server, and everything else by the frontend. I've tried
> many combinations which don't work, which I can post if it's relevant...

Please do.  :-)

[...]
> Does anybody have a pointer to a setup that looks like this?

Maybe I am completely misunderstanding the problem, but a guess
would be something like the following in the proxy:

ProxyPreserveHost yes
RewriteRule ^/(.*\.pl) http://localhost:1234/$1 [P]


  ServerName foo.example.com
  RewriteEngine  on
  RewriteOptions inherit



...


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();


Re: Transparent front-end proxying for many VirtualHosts

2003-03-05 Thread Perrin Harkins
On Wed, 2003-03-05 at 18:30, Andrew Ho wrote:
> I want to simplify my configuration in two ways. I'd prefer not to
> maintain two sets of VirtualHost configuration data, and I'd like it if
> the block that proxies .pl files to the backend proxy not be replicated
> per VirtualHost.

As others pointed out, mod_macro is good for this.  Personally, I tend
to solve problems like this by generating my httpd.conf with a template
and a tiny Perl script.  That allows me to do absolutely anything in it,
including looking up data from a database to use in the conf file.

- Perrin



Re: Transparent front-end proxying for many VirtualHosts

2003-03-05 Thread Charlie Garrison
Good afternoon,

On 5/3/03 at 3:30 PM, Andrew Ho <[EMAIL PROTECTED]> wrote:

>I have an Apache with many VirtualHosts, and I want to setup proxying so
>that a lightweight frontend Apache with mod_rewrite/mod_proxy proxies
>Apache::Registry script requests back to a heavyweight backend Apache
>running on a localhost-only port.
>
>I want to simplify my configuration in two ways. I'd prefer not to
>maintain two sets of VirtualHost configuration data, and I'd like it if
>the block that proxies .pl files to the backend proxy not be replicated
>per VirtualHost.

I use mod_macro and IfDefine directives to simplify virtual host setups with
backend server.

First I do the bulk of the config in httpd.conf as usual (seperate conf files
for frontend and mod_perl) and then use Include directive to load files (one
for each virt host) from a directory.

Each included conf file is loaded by both frontend & mod_perl servers and
IfDefine controls which parts are used for each server.  This is a short
sample file (the Use directives are for mod_macro):



Use mSiteRoot gcs garrison.com.au

Use mSiteLogs_frontend gcs
Use mSiteUserGroup gcs

Use mSiteRootDirOptions gcs
Use mSiteCgiBinDirOptions gcs

Use mSetupRewrite
Use mSiteRewriteRules   






Use mSiteRoot gcs garrison.com.au

Use mSiteLogs_modperl gcs
Use mSiteUserGroup gcs

Use mSiteRootDirOptions gcs
Use mSitePerlBinDirOptions gcs





This setup doesn't put all the rewrite config in the main conf file, but it
does centralize it all to make maintenance much easier. And there is only one
conf file for each virt host.


Charlie
-- 
   Charlie Garrison[EMAIL PROTECTED]
   PO Box 141, Windsor, NSW 2756, Australia 


Re: Transparent front-end proxying for many VirtualHosts

2003-03-05 Thread Larry Leszczynski
Hi Andrew -

> I want to simplify my configuration in two ways. I'd prefer not to
> maintain two sets of VirtualHost configuration data, and I'd like it
> if the block that proxies .pl files to the backend proxy not be
> replicated per VirtualHost.

Have you looked at mod_macro?  Depending on how similar your virtual hosts
are to each other, it might be useful. For example, suppose you set up
config files like so:

FrontEndMacros.cfg:

   
  
 ServerName $host
 DocumentRoot $dir
 
RewriteRule ...rule to proxy to backend...
 
 ...other frontend config stuff...
  
   

BackEndMacros.cfg:

   
  
 ServerName $host
 DocumentRoot $dir
 ...other backend config stuff...
  
   

MyVirtualHosts.cfg:

   Use MyVirtualHost www.siteA.com /path/to/siteA/htdocs
   Use MyVirtualHost www.siteB.com /path/to/siteB/htdocs
   Use MyVirtualHost www.siteC.com /path/to/siteC/htdocs

httpd.conf for frontend:

   Listen 1.2.3.4:80
   NameVirtualHost *
   Include FrontEndMacros.cfg
   Include MyVirtualHosts.cfg

httpd.conf for backend:

   Listen 127.0.0.1:8080
   NameVirtualHost *
   Include BackEndMacros.cfg
   Include MyVirtualHosts.cfg


This could let you maintain just one included file that defined the list
of virtual hosts, and even though the proxying block would be replicated
for each frontend host, at least you wouldn't have to do that manually.  
You could probaly even combine the macro definitions in FrontEndMacros.cfg
and BackEndMacros.cfg with some appropriately placed  blocks.

More mod_macro info is at:
   http://www.coelho.net/mod_macro/
(It says it's an Apache 2 module but version 1.1.2 works with Apache
1.3.X)


HTH,
Larry Leszczynski
[EMAIL PROTECTED]




Transparent front-end proxying for many VirtualHosts

2003-03-05 Thread Andrew Ho
Hello,

I've looked through the mod_rewrite and Guide documentation and can't seem
find an answer for this, but feel free to point me at TFM to R if I just
missed it.

I have an Apache with many VirtualHosts, and I want to setup proxying so
that a lightweight frontend Apache with mod_rewrite/mod_proxy proxies
Apache::Registry script requests back to a heavyweight backend Apache
running on a localhost-only port.

I want to simplify my configuration in two ways. I'd prefer not to
maintain two sets of VirtualHost configuration data, and I'd like it if
the block that proxies .pl files to the backend proxy not be replicated
per VirtualHost.

The conceptual behavior I want, is for  to be proxied
by the backend server, and everything else by the frontend. I've tried
many combinations which don't work, which I can post if it's relevant...
it seems that having a map outside of  blocks doesn't work (I
get a GET /real/path/on/filesystem/to/foo.pl HTTP/1.0 on the backend) and
that requests with path_info don't work.

Does anybody have a pointer to a setup that looks like this?

Thanks in advance!

Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer1-800-555-TELL  Voice 650-930-9062
Tellme Networks, Inc. Fax 650-930-9101
--