You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Patrick Galbraith <pa...@patg.net> on 2003/10/08 19:58:43 UTC
simple two server (front end - back end) setup help
Hi there everyone,
I'm setting up a simple two server setup with mod_perl. I've tested
static documents, and they work fine. The ones I have a rewrite rule for
are served by the front end, and the ones not in the rule by the
backend. The problem comes when I run perl scripts (via
Apache::Registry). I tested these scripts by directly connecting to the
the backend, and they work fine. I even wrote a simple hello world
script. It works fine on the backend, but when run on the front end,
it's blank. The other more full featured scripts give me:
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /bin/brochure.pl.
Reason: Document contains no data
I suspect this has to do with the headers. When I add:
print "Content-type: text/html\n\n" to the simple test script, it runs,
but is displayed as if it were plaintext.
My setup:
One server is just a mod_proxy/mod_rewrite setup to handle static
content, and it's virtual host setting is this:
<VirtualHost test.testserver.com:80>
ServerName test.testserver.com
DocumentRoot /home/testserver/www
TransferLog /usr/local/proxy-apache/logs/testserver_access_log
ErrorLog /usr/local/proxy-apache/logs/testserver_error_log
<Directory "/usr/testserver/www">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 9
RewriteEngine on
RewriteRule \.(gif|jpg|png|txt|html)$ - [L]
RewriteRule ^/bin/(.*) http://127.0.0.1:8080/bin/$1 [P,L]
ProxyPassReverse / http://test.testserver.com:8080/bin
ProxyPassReverse /bin http://127.0.0.1:8080/bin
</VirtualHost>
ProxyIOBufferSize 131072
ProxyReceiveBufferSize 0
And then the mod_perl enabled server is set up this way:
Listen 8080
...
NameVirtualHost *:8080
...
<VirtualHost *:8080>
ServerName test.testserver.com
DocumentRoot /home/testserver/www
CustomLog /usr/local/perl-apache/logs/testserver-access_log assa
ErrorLog /usr/local/perl-apache/logs/testserver-error_log
<Directory "/home/testserver/www">
Options MultiViews
</Directory>
<Directory "/home/testserver/www/bin">
Options ExecCGI MultiViews
</Directory>
# Make sure we're being hit at www address so
# cookies work. We also allow 127.0.0.1 for use
# by the front-end proxies.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^test\.testserver\.com [NC]
RewriteCond %{HTTP_HOST} !^127\.0\.0\.1 [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://test.testserver.com/$1 [L,R=permanent]
RewriteLog "/tmp/perl-dev-rewrite.log"
RewriteLogLevel 9
PerlRequire /home/testserver/perl/startup.pl
AddHandler perl-script .pl
PerlHandler Apache::Registry
PerlModule Apache::ModuleConfig;
PerlModule Apache::Request;
PerlModule Apache::Cookie;
PerlPostReadRequestHandler My::ProxyRemoteAddr
</VirtualHost>
What obvious thing am I doing wrong? It must be a simple change to get
it to work, I suspect, as are most problems that take a long time to
figure out! ;)
thank you in advance for any help!
regards,
Patrick
----------------------
Patrick Galbraith
Senior Software Developer
patrick@redweek.com
patg@patg.net capttofu@slashdot.org
206.719.2461