Keywords: Apache mandrake mod_perl proxy rewrite
Mandrake's Apache installation for later releases (I see it in my copies of 8.0 onwards; I'm running 8.1, 8.2 and 9.0) has a configuration known as the Advanced Extranet Server. (In the mandrake distribution it says its
http://www.advx.com
but its not .... try
http://www.advx.org
).
This is an arrangement where there are actually two servers. The main server is a regualr Apache server without mod_perl. The secondary server has mod_perl compiled in.
This topic discusses how I got this to work after much frustration with the other advice I received and found on the web.
| Please Note -----> |
Everything else written on this site about mod_perl and most of what you will find on the web about mod_perl doesn't apply to this configuration. |
<----- Please Note |
The first thing to realise is that there is no mod_perl to add to the list of modules in the server.
The second thing to realise is that all the examples in such topics as
ModPerl and
ModPerlUnix have
absolutely nothing to do with this kind of configuration. Reding and trying them will just lead to frustration.
The third thing to realise is that while this configuration is called a "proxy", its not like any proxy you've met. Usually the proxy sites between the client and the application. In this case the proxy sits off to one side.
Unless you want to call the main server the proxy and the "other" server the real server
I'm going to call the server that has mod_perl compiled in the
perlproxy.
The idea is that the main server should recognise scripts that can be, should be or could better be executed by the perlproxy and send them over.
The fourth thing to realise - or that I had to realise - is that the configuration of the servers "out of the box" is somewhere on the spectrum of "confusing" to "unhelpful". But then I'm not an Apache Guru. There could be an easier way.
Out of the box the configuration read:
<IfDefine PERLPROXIED>
ProxyPass /perl/ http://127.0.0.1:8200/
ProxyPassReverse /perl/ http://127.0.0.1:8200/
</IfDefine>
Its a good clue but I couldn't get it to work. Probably my fault. YMMV.
It does tell me, as I verified by looking at /etc/httpd/conf/httpd-perl.conf
that the perlproxy listens on port 8200 of the local machine.
What I did get to work was the re-write mechanism.
I put the following in %SCRIPTURLPATH/.htaccess
<IfDefine PERLPROXIED>
RewriteEngine on
RewriteRule ^proxy:.* - [F]
RewriteRule ^.(.*\/twiki\/bin\/.*.pl)$ http://%{HTTP_HOST}:8200$1
</IfDefine>
Please note that the %SCRIPTSUFFIX% is there and set to ".pl".
I suppose I could have used a more general expression in the main httpd.conf
file and grabbed all the "*.pl" files, but this was very localized.
It works. The speedup is noticable, the pages now snap back "instantly".
I'm sure someone can tell me how to make this work better or faster or simpler or more robustly.
Please do.
My next step, while waiting for beijing to arrive, is to figure out how to
make this into a virtual host so that it can be accessed from both the intranet
and the extranet, which not only have different IP's but also use different domain names.
Any advice on this would be welcome.
--
AntonAylward - 07 Jan 2003