You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2008/11/13 16:03:28 UTC
DO NOT REPLY [Bug 46198] New: mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
Summary: mod_userdir is not giving the correct DOCUMENT_ROOT,
also causes issues with mod_rewrite
Product: Apache httpd-2
Version: 2.2.10
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P3
Component: All
AssignedTo: bugs@httpd.apache.org
ReportedBy: apache@hm2k.org
Similar to the "DOCUMENT_ROOT environment variable set incorrectly with
VirtualDocumentRoot" bug located here:
https://issues.apache.org/bugzilla/show_bug.cgi?id=26052
I have found that when using mod_userdir the DOCUMENT_ROOT does not return the
document root of the user.
IE:
visiting url:
http://example.com/~user/
DOCUMENT_ROOT returns:
/var/www/
it should return:
/home/user/public_html/
I am on the understanding that we shouldn't rely on DOCUMENT_ROOT, however it
seems that other modules do, such as mod_rewrite where it looks in the wrong
place for the files.
IE:
RewriteRule ^(.+)$ index.php [L,QSA]
In url:
http://example.com/~user/
It will be looking in:
/var/www/
With url:
http://user.example.com/
It will be looking in
/home/user/public_html/
Both should be looking in the same place.
RewriteBase isn't possible as it is URL-based not filesystem.
This appears to be a fairly common bug, with no realistic solution.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
--- Comment #5 from HM 2K <ap...@hm2k.org> 2008-11-13 13:17:55 PST ---
The issue is not with RewriteBase, leaving RewriteBase on or off is not a
conditional option, since both URLs point to the same directory the RewriteBase
is either on or off in the `.htaccess` for both cases.
In both cases mod_rewrite should be looking in the working directory rather
than the document_root, but it doesn't.
The reality of the issue is that DOCUMENT_ROOT should be that of the userdir,
and if that can't be done, mod_rewrite should be looking in the userdir before
it looks in the DOCUMENT_ROOT.
(In reply to comment #4)
> (In reply to comment #3)
> > RewriteBase is relative to the URL not to the filesystem so that won't work in
> > all cases.
>
> The premise is that it works in all cases that the base URL got you to the
> correct directory in the first place, because that's how mod_rewrite re-injects
> the modifications (and ends up back in the same directory). When you leave the
> RewriteBase off, and don't use a full filesystem path in your substitution, and
> you're operating per-directory, you don't end up back in the same spot.
>
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
HM 2K <ap...@hm2k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |apache@hm2k.org
--- Comment #1 from HM 2K <ap...@hm2k.org> 2008-11-13 07:31:02 PST ---
I think we can agree that mod_rewrite used under userdir should be looking in
the userdir not in the virtualhost DOCUMENT_ROOT.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
--- Comment #4 from Eric Covener <co...@gmail.com> 2008-11-13 11:17:43 PST ---
(In reply to comment #3)
> RewriteBase is relative to the URL not to the filesystem so that won't work in
> all cases.
The premise is that it works in all cases that the base URL got you to the
correct directory in the first place, because that's how mod_rewrite re-injects
the modifications (and ends up back in the same directory). When you leave the
RewriteBase off, and don't use a full filesystem path in your substitution, and
you're operating per-directory, you don't end up back in the same spot.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
Stefan Fritsch <sf...@sfritsch.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #8 from Stefan Fritsch <sf...@sfritsch.de> 2012-02-26 16:50:15 UTC ---
fixed in 2.4.1
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
Stefan Fritsch <sf...@sfritsch.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |FixedInTrunk
--- Comment #7 from Stefan Fritsch <sf...@sfritsch.de> 2011-06-05 21:38:19 UTC ---
With the change in r1132494, mod_userdir now sets the new CONTEXT_DOCUMENT_ROOT
and CONTEXT_PREFIX variables, which contain the necessary information to
correctly rewrite URLs.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
Eric Covener <co...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #2 from Eric Covener <co...@gmail.com> 2008-11-13 09:27:51 PST ---
You have to use a RewriteBase if you want to rewrite to a relative filename
like this. Did you leave it off entirely?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
HM 2K <ap...@hm2k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #3 from HM 2K <ap...@hm2k.org> 2008-11-13 10:13:27 PST ---
RewriteBase is relative to the URL not to the filesystem so that won't work in
all cases.
The cases are as follows:
http://example.com/
https://secure.example.net/~user/
In both of these cases the working directory is /home/user/public_html/
https://secure.example.net/ has a working directory of
/home/secure/public_html/
You would expect the document root of https://secure.example.net/~user/ to be
/home/user/public_html NOT /home/secure/public_html/ which is (in this case)
the document root of https://secure.example.net/
mod_userdir should update the document_root to the userdir OR mod_rewrite
should use the userdir not the document_root if it exists.
IE:
http://example.com/ is DOCUMENT_ROOT=/home/user/public_html/
https://secure.example.net/ is DOCUMENT_ROOT=/home/secure/public_html/
These are correct.
https://secure.example.net/~user/ is DOCUMENT_ROOT=/home/secure/public_html/
https://secure.example.net/~user/ should be
DOCUMENT_ROOT=/home/user/public_html/
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 46198] mod_userdir is not giving the correct
DOCUMENT_ROOT, also causes issues with mod_rewrite
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46198
--- Comment #6 from Bob Ionescu <bo...@googlemail.com> 2008-11-21 15:45:02 PST ---
(In reply to comment #5)
> and if that can't be done, mod_rewrite should be looking in the userdir before
> it looks in the DOCUMENT_ROOT.
I disagree that the Document_root should be set dynamically, since this is not
the document_root of that domain, but more or less an alias.
Where did you place the RewriteRule? Under which path (either .htaccess or
<directory...> section?
I assume a per-directory configuration under /home/user/public_html/
Since your substitution index.php is a local filepath, i.e. it does not start
with a leading slash, mod_rewrite will add the directory prefix
/home/user/public_html/ which results in /home/user/public_html/index.php.
There are now two possible ways, while the 1st one will take precedence.
- mod_rewrite tries to replace the directory-prefix with RewriteBase, the
URL-path of /home/user/public_html/ is /~user/, so we need 'RewriteBase
/~user/'. Mod_rewrite replaces /home/user/public_html/ with /~user/ and goes
with /~user/index.php into the internal redirect
- mod_rewrite tries to substitute the document_root from the directory-prefix.
If your URL-path is not related to the filesystem path, this reduction feature
will fail.
As the documentation states "If your webserver's URLs are not directly related
to physical file paths [that is the case if you're using mod_userdir or
mod_alias], you will need to use RewriteBase in every .htaccess file where you
want to use RewriteRule directives."
What do you mean by "It will be looking in:"? The self reduction process to an
URL-path will fail, so your "URL-path" is now /home/user/public_html/index.php
- the same, if you typed into your browser's location bar
http://example.com/home/user/public_html/index.php. And such a request will be
mapped to /var/www/home/user/public_html/index.php.
Remember: At the end of th rewriting process, mod_rewrite needs an URL-path,
you can either define the path directly in the substitution:
RewriteRule ^foo /~user/index.php [L]
or use the features provided by mod_rewrite to built the URL-path, but one
won't work in all cases (as documented).
Therefore I cannot see a bug, that's exactly the case why the directive
RewriteBase was developed.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org