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 2012/09/24 11:03:43 UTC
[Bug 53929] New: RewriteRule of "^$" broke between 2.2.21 and 2.4.2
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Priority: P2
Bug ID: 53929
Assignee: bugs@httpd.apache.org
Summary: RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Severity: normal
Classification: Unclassified
Reporter: victor.shih@gmail.com
Hardware: PC
Status: NEW
Version: 2.4.2
Component: mod_rewrite
Product: Apache httpd-2
The following .htaccess configuration worked fine in 2.2.21:
RewriteCond %{DOCUMENT_ROOT}/index-cached.html -f
RewriteRule ^$ /index-cached.html [L]
RewriteCond %{DOCUMENT_ROOT}/$1-cached.html -f
RewriteRule ^([^/]+?)/$ /$1-cached.html [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
where browsing to "http://test.local" returns the contents of index-cached.html
correctly.
However, in 2.4.2, processing falls through to index.php, even though the logs
seem to indicate that the first condition was matched:
[rid#13ad0b0/initial] [perdir C:/test/] strip per-dir prefix: C:/test/ ->
[rid#13ad0b0/initial] [perdir C:/test/] applying pattern '^$' to uri ''
[rid#13ad0b0/initial] [perdir C:/test/] RewriteCond:
input='C:/test/index-cached.html' pattern='-f' => matched
[rid#13ad0b0/initial] [perdir C:/test/] rewrite '' -> '/index-cached.html'
[rid#13ad0b0/initial] [perdir C:/test/] trying to replace prefix C:/test/
with /
[rid#13ad0b0/initial] [perdir C:/test/] internal redirect with
/index-cached.html [INTERNAL REDIRECT]
[rid#13b30c8/subreq] [perdir C:/test/] strip per-dir prefix:
C:/test/index.php -> index.php
[rid#13b30c8/subreq] [perdir C:/test/] applying pattern '^$' to uri
'index.php'
[rid#13b30c8/subreq] [perdir C:/test/] strip per-dir prefix:
C:/test/index.php -> index.php
[rid#13b30c8/subreq] [perdir C:/test/] applying pattern '^([^/]+?)/$' to uri
'index.php'
[rid#13b30c8/subreq] [perdir C:/test/] strip per-dir prefix:
C:/test/index.php -> index.php
[rid#13b30c8/subreq] [perdir C:/test/] applying pattern '^index\\.php$' to
uri 'index.php'
[rid#13b30c8/subreq] [perdir C:/test/] pass through C:/test/index.php
Notice that after the "initial" request finishes, a "subreq" is generated,
whereas "initial/redir#1" was expected.
Both of my 2.2.21 and 2.4.2 environments have mod_dir enabled, which may or may
not have bearing on this issue.
Note also that the second rule works in both versions; that is, browsing to
"http://test.local/a/" correctly returns the contents of a-cached.html.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #3 from jkaluza@redhat.com ---
Created attachment 30827
--> https://issues.apache.org/bugzilla/attachment.cgi?id=30827&action=edit
proposed patch
This patch fixes this issue for me without breaking ABI. Normally r->uri and
r->filename ends with "/" in the case of directory request. If mod_rewrite
rewrites URL later in hook_fixup, it changes r->filename. In this patch, I
check if the r->filename still ends with "/" and if not, return DECLINED in
mod_dir fixup hook.
I think there is still problem if you rewrite r->filename from directory to
directory, but it should fix case when you rewrite from directory to file. I
don't see immediate solution for directory to directory rewrite.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #2 from jkaluza@redhat.com ---
Not so useful as I thought, but maybe it could help someone. Using git-bisect
I've found out this is caused by following commit:
http://svn.apache.org/viewvc?view=revision&revision=233369
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #10 from John Flatness <jo...@zerocrates.org> ---
Aha, thanks for that update. 2.4.9 does appear to fix the problem I was having.
The behavior now seems to be consistent with 2.2, and a rewrite rule that
conflicts with a DirectoryIndex gets applied.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Eric Covener <co...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |RESOLVED
Resolution|--- |FIXED
--- Comment #11 from Eric Covener <co...@gmail.com> ---
Thanks for testing
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
tm@core.io changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tm@core.io
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Benjamin Coddington <bc...@uvm.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bcodding@uvm.edu
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Joyce Babu <co...@joycebabu.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |contact@joycebabu.com
Hardware|PC |All
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #9 from Eric Covener <co...@gmail.com> ---
> Can you test with the patches in the previous comment?(In reply to John
> Flatness from comment #7)
ignore this part in last comment, forgot it was actually backported and
available in 2.4.9.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
John Flatness <jo...@zerocrates.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |john@zerocrates.org
--- Comment #4 from John Flatness <jo...@zerocrates.org> ---
The same issue seems to still be present as of 2.4.6.
I see the same behavior described here: for the "initial" request, my rule is
applied as I expect, the substitution happens and there's an [INTERNAL
REDIRECT] with my correct, desired URL. Then, the next log lines are all
"subreq" and are operating on the DirectoryIndex file. Basically,
DirectoryIndex seems to take precedence over RewriteRules.
These same rules work correctly in 2.2, and disabling DirectoryIndex allows the
rewrite to take place as expected.
This also seems to be the same problem as described in Bug 53794. There is a
different proposed patch there.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #5 from Mark Jenkins <ma...@mailfish.de> ---
I have the same problem here. Any chance to see a fix soon? This bug has been
around for more than a year now and it's pretty annoying.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Eric Covener <co...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #8 from Eric Covener <co...@gmail.com> ---
(In reply to John Flatness from comment #7)
> I see that there's a related commit(s) for this on the trunk.
>
> Is there any chance of seeing this fixed in the 2.4 series?
Can you test with the patches in the previous comment?(In reply to John
Flatness from comment #7)
> I see that there's a related commit(s) for this on the trunk.
>
> Is there any chance of seeing this fixed in the 2.4 series?
Can you try with 2.4.9? Supposd to be fixed there.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Eric Covener <co...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |normadize@gmail.com
--- Comment #12 from Eric Covener <co...@gmail.com> ---
*** Bug 56434 has been marked as a duplicate of this bug. ***
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #7 from John Flatness <jo...@zerocrates.org> ---
I see that there's a related commit(s) for this on the trunk.
Is there any chance of seeing this fixed in the 2.4 series?
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
--- Comment #1 from Joyce Babu <co...@joycebabu.com> ---
I am also experiencing this issue. The issue is caused by the DirectoryIndex
directive. mod_dir is not respecting the result of the rewrite execution. If
DirectoryIndex is set to disabled, it starts working correctly. Similarly,
using SetHandler also resolved the problem.
Unfortunately, since both the directives are inherited by files/sub
directories, it is not a proper solution.
I was able to work around it by setting an environment variable using the
mod_rewrite, and Disabling DirectoryIndex for those requests.
RewriteEngine on
RewriteRule ^$ /test/home.php [NC,QSA,END,E=IS_DIR_INDEX:1]
<If "env('IS_DIR_INDEX') == 1">
SetHandler default_handler
</If>
There is a related issue which is present in 2.2 too. DirectoryIndex directive
does not pass requests for directories to FallbackResource, if the index file
is not found.
--
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
[Bug 53929] RewriteRule of "^$" broke between 2.2.21 and 2.4.2
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53929
Eric Covener <co...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |FixedInTrunk
--- Comment #6 from Eric Covener <co...@gmail.com> ---
Hi Jan, can you check out the approach these two commits before I propose them
for backport?
http://svn.apache.org/r1557640
http://svn.apache.org/r1557641
--
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