Java Mailing List Archive

http://www.apache-httpd.com/

Home » modperl.perl »

Re: WELCOME to modperl@perl.apache.org

Hans de Groot

2010-07-16

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello,

I am trying to use the proxypass directive in mod_perl.

I actually got this working (after upgrading to mod_perl 2.4.x) so I
know it is possible to use proxy pass here
but I still have one problem.

I have a perl hander:

#file:ModPerl/VHost.pm
#-------------------------
package ModPerl::VHost;

use strict;

use Apache2::Const qw(OK DECLINED :options :override);
use Apache2::RequestRec ();
use Apache2::RequestUtil ();
use Apache2::ServerRec ();
use Apache2::ServerUtil ();
use Apache2::Access ();

use Mysql;

my $dbh_persistent = &set_up_connection();

sub handler {
  my $r = shift;
  my $s = $r->server();

# some code to decide which vhost we are.

# here is what I use:

 $r->add_config( [
            'ProxyPass http://www.exampledomain2.com/',
            ]
            ,~0,'/test'
            );

# some more code.
----------------------------------------------

In my httpd.conf I use

PerlPostReadRequestHandler ModPerl::VHost

If I use this I can go to http://www.exampledomain1.com/test and I see
the contents from www.exampledomain2.com/

But when I change the last part to

$r->add_config( [
            'ProxyPass http://www.exampledomain2.com/',
            'AllowOverride Options AuthConfig',
            ]
            ,~0,'/'
            );

I get segmentations faults.

If I change it to

            ,~0,''
            );

I don't get segfault but I also do not get any porxy results. I just
see the default index.html

So how to I get it to proxypass everything for a certain domain (the
/location)?

I cannot use .htaccess files or server directives since this is done
on the fly. I do not want to reload my server config
every time a change is made and I think must be possible since other
locations (like the /test) do work.

ps I use:

httpd-2.2.3-11.el5_2.centos.4
mod_perl-2.0.4-6.el5


Thanks for any help.

Regards

Hans de Groot










©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.