[rt-users] two domains, one RT?

Darren Nickerson darren at dazza.org
Mon Feb 25 12:42:09 EST 2002

>>>>> On Mon, 25 Feb 2002, "darren" == darren chamberlain wrote:

  darren> Quoting Darren Nickerson <darren at dazza.org> [25 Feb-02 11:40]:

  +> But still no joy:

  +> [Mon Feb 25 08:34:51 2002] [warn] [Mason] Cannot resolve file to 
  +> /usr/local/rt2-hyla/WebRT/html/index.html (is file outside component 

  darren> *Is* the file outside of the component root?  Can you post your
  darren> full httpd.conf and webmux.pl?

Thanks for sticking with this thread.

What more do you need from my httpd.conf than the two virtual host containers I
gave you? I can't really paste the whole thing in . . .  I've attached 
webmux.pl though.

I don't think anything's wrong with the setup of this RT instance, since if I 
comment out the first virtual host, so the two look like:

#ServerName support.tpc.int
#ServerAdmin tpcadmin at tpc.int
#ErrorLog logs/support.tpc.int-error_log
#CustomLog logs/support.tpc.int-access_log common
#DocumentRoot /usr/local/rt2-tpc/WebRT/html
#PerlModule Apache::DBI
#PerlFreshRestart On
#PerlRequire /usr/local/rt2-tpc/bin/webmux.pl
#<Location />
# SetHandler perl-script
# PerlHandler RT::Mason

ServerName support.hylafax.org
ServerAdmin webmaster at hylafax.org
ErrorLog logs/support.hylafax.org-error_log
CustomLog logs/support.hylafax.org-access_log common
DocumentRoot /usr/local/rt2-hyla/WebRT/html
PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /usr/local/rt2-hyla/bin/webmux.pl
<Location />
 SetHandler perl-script
 PerlHandler RT::Mason::HylaFAX

Then support.hylafax.org works perfectly, loading the RT login screen.

Modifying the PerlHandler namespace does not seem to have made any difference
- if both vhosts are loaded, the first one works, and the second generates the
component root error.


-------------- next part --------------
# $Header: /raid/cvsroot/rt/bin/webmux.pl,v 1.2 2001/11/06 23:04:00 jesse Exp $
# RT is (c) 1996-2000 Jesse Vincent (jesse at fsck.com);

use strict;
$ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
$ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
$ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
$ENV{'ENV'} = '' if defined $ENV{'ENV'};
$ENV{'IFS'} = ''          if defined $ENV{'IFS'};

# We really don't want apache to try to eat all vm
# see http://perl.apache.org/guide/control.html#Preventing_mod_perl_Processes_Fr

package RT::Mason::HylaFAX;

use CGI qw(-private_tempfiles); #bring this in before mason, to make sure we
				#set private_tempfiles
use HTML::Mason::ApacheHandler (args_method => 'CGI');
use HTML::Mason;  # brings in subpackages: Parser, Interp, etc.

use vars qw($VERSION %session $Nobody $SystemUser $r);

# List of modules that you want to use from components (see Admin
# manual for details)

#Clean up our umask...so that the session files aren't world readable, writable or executable


use lib "/usr/local/rt2-hyla/lib";
use lib "/usr/local/rt2-hyla/etc";

#This drags in  RT's config.pm
use config;
use Carp;

	    package HTML::Mason::Commands;
	    use vars qw(%session);
	    use RT; 
	    use RT::Ticket;
	    use RT::Tickets;
	    use RT::Transaction;
	    use RT::Transactions;
	    use RT::User;
	    use RT::Users;
	    use RT::CurrentUser;
	    use RT::Template;
	    use RT::Templates;
	    use RT::Queue;
	    use RT::Queues;
	    use RT::ScripAction;
	    use RT::ScripActions;
	    use RT::ScripCondition;
	    use RT::ScripConditions;
	    use RT::Scrip;
	    use RT::Scrips;
	    use RT::Group;
	    use RT::Groups;
	    use RT::Keyword;
	    use RT::Keywords;
	    use RT::ObjectKeyword;
	    use RT::ObjectKeywords;
	    use RT::KeywordSelect;
	    use RT::KeywordSelects;
	    use RT::GroupMember;
	    use RT::GroupMembers;
	    use RT::Watcher;
	    use RT::Watchers;
	    use RT::Handle;
	    use RT::Interface::Web;    
	    use MIME::Entity;
	    use Text::Wrapper;
	    use Apache::Cookie;
	    use Date::Parse;
	    use HTML::Entities;
	    #TODO: make this use DBI
	    use Apache::Session::File;

	    # Set this page's content type to whatever we are called with
	    sub SetContentType {
		my $type = shift;

	    sub CGIObject {


my $parser = &RT::Interface::Web::NewParser(allow_globals => [%session]);

my $interp = &RT::Interface::Web::NewInterp(parser=>$parser);

my $ah = &RT::Interface::Web::NewApacheHandler($interp);

# Activate the following if running httpd as root (the normal case).
# Resets ownership of all files created by Mason at startup.
chown (Apache->server->uid, Apache->server->gid, 

chown (Apache->server->uid, Apache->server->gid, 

# Die if WebSessionDir doesn't exist or we can't write to it

stat ($RT::MasonSessionDir);
die "Can't read and write $RT::MasonSessionDir"
  unless (( -d _ ) and ( -r _ ) and ( -w _ ));

sub handler {
    ($r) = @_;
    # We don't need to handle non-text items
    return -1 if defined($r->content_type) && $r->content_type !~ m|^text/|io;
    #This is all largely cut and pasted from mason's session_handler.pl
    my %cookies = Apache::Cookie::parse($r->header_in('Cookie'));
    eval { 
	tie %HTML::Mason::Commands::session, 'Apache::Session::File',
	  ( $cookies{'AF_SID'} ? $cookies{'AF_SID'}->value() : undef ), 
	    { Directory => $RT::MasonSessionDir,
	      LockDirectory => $RT::MasonSessionDir,
	    }	;
    if ( $@ ) {
	# If the session is invalid, create a new session.
	if ( $@ =~ m#^Object does not exist in the data store# ) {
	     tie %HTML::Mason::Commands::session, 'Apache::Session::File', undef,
	     { Directory => $RT::MasonSessionDir,
	       LockDirectory => $RT::MasonSessionDir,
	     undef $cookies{'AF_SID'};
	  else {
	     die "RT Couldn't write to session directory '$RT::MasonSessionDir'. Check that this directory's permissions are correct.";
    if ( !$cookies{'AF_SID'} ) {
	my $cookie = new Apache::Cookie
	   -path => '/',);

    my $status = $ah->handle_request($r);
    untie %HTML::Mason::Commands::session;
    return $status;

More information about the rt-users mailing list