You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Noah Robin <si...@onastick.net> on 2002/01/07 01:09:34 UTC

mod_rewrite/9386: mod_rewrite 'PT' flag reveals real path to directory

>Number:         9386
>Category:       mod_rewrite
>Synopsis:       mod_rewrite 'PT' flag reveals real path to directory
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sun Jan 06 16:10:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     sitz@onastick.net
>Release:        1.3.22
>Organization:
apache
>Environment:
Solaris 2.6, 105181-23 with gcc-2.95.2
Linux 2.2.19+openwallpatch with gcc-2.95.4
>Description:
I have configured a mod_rewrite ruleset to handle mass virtualhosts (mod_mass_vhost wasn't flexible enough). My ruleset is straightforward:

    RewriteMap  lowercase   int:tolower
    RewriteMap  vhost       dbm:/conf/vhosts_db
    RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
    RewriteCond   ${vhost:%1}  ^(/.*)$
    RewriteRule   ^/(.*)$   %1/$1 [L,PT]

However, if the server needs to return a 403 or 404 (and likely other error conditions in which a path to the offending file is displayed), I get the following error:

The requested URL /htdocs/users/username/nonexistant/path was not found on this server.

If I change the RewriteRule to:

RewriteRule   ^/(.*)$   %1/$1 [L]

I get:

The requested URL /nonexistant/path was not found on this server.

I do realize that this is the result of the PT flag doing what it was designed to do, but didn't know whether this particular condition was known or not.
>How-To-Repeat:

>Fix:
*shrug* Error condition shouldn't, IMO, return the absolute path to a file. The handling which is seen sans 'PT' is correct. 
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]