[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Apache 2.2.3-4+etch5 (apache2-mpm-worker) mod_rewrite BUG



Package: apache2-mpm-worker
Version: 2.2.3-4+etch5
Severity: important

According to http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule <http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule> :

"The Substitution of a rewrite rule is the string that replaces the original URL-path that was matched by Pattern. The Substitution may be a:
[...]
*file-system path*
Designates the location on the file-system of the resource to be delivered to the client.
URL-path
A DocumentRoot-relative path to the resource to be served. *Note that mod_rewrite tries to guess whether you have specified a file-system path or a URL-path by checking to see if the first segment of the path exists at the root of the file-system.* For example, if you specify a Substitution string of /www/file.html, then this will be treated as a URL-path unless a directory named www exists at the root or your file-system, in which case it will be treated as a file-system path. If you wish other URL-mapping directives (such as Alias) to be applied to the resulting URL-path, use the [PT] flag as described below.
[...]"

TEST CASE:
1. In apache2.conf, add the following section
<FilesMatch "\.test$">
      Options FollowSymLinks
      RewriteEngine On
      RewriteRule ^(.*)$ $1.gz [L,PT]
</FilesMatch>
2. touch <DocumentRoot>/bar.test.gz
3. Access http://localhost/bar.test <http://localhost/foo>

ACTUAL RESULT:
You get an error page "The requested URL <DocumentRoot>/bar.test.gz was not found on this server.", because the substitution gets interpreted as URL relative to DocumentRoot For example, if the document root is "/var/www/example/" you'll find in the error log "File does not exist: /var/www/example/var"

EXPECTED:
The file <DocumentRoot>/bar.test.gz should be served.

A similar bug has already be filed on Ubuntu's bugtracking by someone else here : https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/174282 I guess it is related but the bug has been closed "because it lacks the information we need to investigate the problem".

By advance, thanks.

François.


Reply to: