[rt-users] Mason problem?

Stephen Quinney stephen.quinney at computing-services.oxford.ac.uk
Fri Jun 25 08:29:20 EDT 2004


On Thu, Jun 24, 2004 at 12:41:28PM -0500, Erik Anderson wrote:
> I'm running rt-3.0.11, apache-2.0.49, and mod_perl-1.99_11.
> 
> Apache doesn't seem to be obeying the DirectoryIndex directives.  If I
> navigate to http://helpdesk.foo.com/, I get a 404, but if I navigate
> to http://helpdesk.foo.com/index.html, I get the correct rt login
> page.
> 
> I have verified that index.html *is* listed in the DirectoryIndex
> Directive, so I'm thinking that the mason handler or something else is
> screwing up the request.
> 
> I get this in my apache error_log when I make a request to / :
> 
> [Thu Jun 24 12:40:42 2004] [error] [client 192.168.1.95] Attempt to
> serve directory: /opt/rt3/share/html/

There is a problematic interaction between the modperl2 handler system
and the Apache2 module that takes a request for a directory and serves
up the index page, if it exists.

There are various solutions that use apache config options for
mod_rewrite. One is suggested in the README that comes with rt3:

    RewriteEngine On
    RewriteRule ^(.*)/$ $1/index.html

I am not certain this is exactly the correct thing to do. I came up
with something like this for the suggested Apache2/modperl2 config in
the Debian package:

####### begin #######
AddDefaultCharset UTF-8

PerlModule Apache2 Apache::compat
PerlModule Apache::DBI
PerlRequire /usr/share/request-tracker3/libexec/webmux.pl
PerlSetVar MasonArgsMethod CGI

RewriteEngine on

# This assumes your site has a base absolute url of /rt
# e.g. http://www.example.com/rt

# Ensure we always have a trailing slash after the rt base

RewriteRule ^/rt$ /rt/

# Rewrite urls to physical locations

RewriteRule ^/rt/(.*)$ /usr/share/request-tracker3/html/$1

# Directory requests need an index.html appended

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(/usr/share/request-tracker3/html.*)/$ $1/index.html

<Directory /usr/share/request-tracker3/html>
 SetHandler perl-script
 PerlHandler RT::Mason
</Directory>
####### end #######

I have tested this with various situations and it seems to work
well. Obviously it would need a fair bit of alteration if you were
using a Location directive or had the base physical location as your
DocumentRoot. I think this gives the basic idea of how to do the
rewriting though.

Stephen Quinney
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20040625/f11b6544/attachment.sig>


More information about the rt-users mailing list