[Rt-commit] rt branch, 4.0/devel-apache-404s, created. rt-4.0.10-73-ge883787

Alex Vandiver alexmv at bestpractical.com
Wed Mar 6 20:45:43 EST 2013


The branch, 4.0/devel-apache-404s has been created
        at  e883787b682287a6da845c63402df088f3832b2a (commit)

- Log -----------------------------------------------------------------
commit e883787b682287a6da845c63402df088f3832b2a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Mar 6 20:42:51 2013 -0500

    Explicitly force 404s on non-WebPath requests
    
    Because the DocumentRoot is set to share/html, a request for /index.html
    with WebPath set to /rt still _succeeds_, and presents the Mason source
    for share/html/index.html
    
    Add an explicit rewrite rule to 404 anything which is not under the
    WebPath.

diff --git a/devel/tools/rt-apache b/devel/tools/rt-apache
index ba130de..c2e2285 100755
--- a/devel/tools/rt-apache
+++ b/devel/tools/rt-apache
@@ -148,6 +148,7 @@ my @opts = ("-f", $conf, "-D" . uc($mod) );
 push @opts, "-DSSL" if $opt{ssl};
 push @opts, "-DRT3" if $opt{rt3};
 push @opts, "-DSINGLE" if $opt{single};
+push @opts, "-DREDIRECT" if $path;
 
 # Wait for a previous run to terminate
 if ( open( PIDFILE, "<", "$opt{root}/var/apache2.pid") ) {
@@ -336,6 +337,12 @@ Alias $PATH/NoAuth/images/ $RTHOME/share/html/NoAuth/images/
     Allow from all
 </Directory>
 
+<IfDefine REDIRECT>
+    LoadModule rewrite_module $MODULES/mod_rewrite.so
+    RewriteEngine on
+    RewriteRule ^(?!\Q$PATH\E) - [R=404]
+</IfDefine>
+
 <IfDefine !RT3>
 ########## 4.0 mod_perl
 <IfDefine PERL>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list