# To use RT together with mod_perl2, available in the 
# libapache2-mod-perl2 package, include this file with:
#
#   Include /etc/request-tracker3.8/apache2-modperl2.conf
# 
# into your Apache configuration file, in a virtual host section.

# You will need to enable the Apache modules: perl, actions, rewrite
#
# The best place for this in the Debian Apache2 default situation is
# near the end of the VirtualHost section in the file
# /etc/apache2/sites-available/default.

# You might want to enable this line
# AddDefaultCharset UTF-8

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

# Normally a request for a directory will be rewritten to index.html
# (or similar) by default if that file exists. For some reason this does
# not happen with the handler being set to perl-script. We thus have to
# do it ourselves using mod_rewrite.

RewriteEngine on

# You might need to alter these two lines which refer to /rt to match
# whatever base URL you are using for your rt3 site.

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

# We need this to prevent requests for images being sent through to
# the RT::Mason handler.

<Directory /usr/share/request-tracker3.8/html/NoAuth/images>
  SetHandler default-handler
</Directory>

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

# Limit mail gateway access to localhost by default
<Location /rt/REST/1.0/NoAuth>
    Order Allow,Deny
    Allow from 127.0.0.1
</Location>

