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 2014/04/20 04:36:18 UTC

[Bug 56434] New: Rewrite rule for root / matches, but end flag is ignored (subreq for index files still proceeds)

https://issues.apache.org/bugzilla/show_bug.cgi?id=56434

            Bug ID: 56434
           Summary: Rewrite rule for root / matches, but end flag is
                    ignored (subreq for index files still proceeds)
           Product: Apache httpd-2
           Version: 2.4.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: mod_rewrite
          Assignee: bugs@httpd.apache.org
          Reporter: normadize@gmail.com

As first asked on http://bit.ly/1hYKkHC and http://bit.ly/1hYKtL9

Apache 2.4.7 on Ubuntu 14.04. The rewrite rule is simple:

RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^ /web/wp-content/cache/page_enhanced/HOSTNAME/_index.html [L]

Basically, I want to serve an .html file for /. The .html file exists and is
served fine if requested directly. As you can see in the debug logs below the
cond on / does match (initial), but then Apache proceeds (subreq) and tries to
match /index.html, /index.cgi, /index.pl and /index.php, and finally serves
/index.php.

This is not expected since [L] should prevent Apache from continuing once a
match is found.

I can confirm that this problem does not exist in Apache 2.2.

Also, this appears to be a problem only for /. The same rule but for a
subdirectory works as expected, i.e.:

RewriteCond %{REQUEST_URI} ^/subdir/?$
RewriteRule ^ /web/wp-content/cache/page_enhanced/HOSTNAME/subdir/_index.html
[L]

... works just fine.

Rewrite debug logs:

# grep rewrite: /var/log/apache2/error.log
[Sat Apr 19 20:40:14.581933 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabc90a0/initial] [perdir
/var/www/HOSTNAME/] strip per-dir prefix: /var/www/HOSTNAME/ -> 
[Sat Apr 19 20:40:14.581957 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabc90a0/initial] [perdir
/var/www/HOSTNAME/] applying pattern '.*' to uri ''
[Sat Apr 19 20:40:14.581963 2014] [rewrite:trace4] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabc90a0/initial] [perdir
/var/www/HOSTNAME/] RewriteCond: input='/' pattern='^/?$' => matched
[Sat Apr 19 20:40:14.581966 2014] [rewrite:trace2] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabc90a0/initial] [perdir
/var/www/HOSTNAME/] rewrite '' ->
'/web/wp-content/cache/page_enhanced/HOSTNAME/_index.html'
[Sat Apr 19 20:40:14.581969 2014] [rewrite:trace1] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabc90a0/initial] [perdir
/var/www/HOSTNAME/] internal redirect with
/web/wp-content/cache/page_enhanced/HOSTNAME/_index.html [INTERNAL REDIRECT]
[Sat Apr 19 20:40:14.582407 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] strip per-dir prefix: /var/www/HOSTNAME/index.html ->
index.html
[Sat Apr 19 20:40:14.582414 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] applying pattern '.*' to uri 'index.html'
[Sat Apr 19 20:40:14.582418 2014] [rewrite:trace4] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] RewriteCond: input='/index.html' pattern='^/?$' =>
not-matched
[Sat Apr 19 20:40:14.582420 2014] [rewrite:trace1] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] pass through /var/www/HOSTNAME/index.html
[Sat Apr 19 20:40:14.582767 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] strip per-dir prefix: /var/www/HOSTNAME/index.cgi ->
index.cgi
[Sat Apr 19 20:40:14.582772 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] applying pattern '.*' to uri 'index.cgi'
[Sat Apr 19 20:40:14.582775 2014] [rewrite:trace4] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] RewriteCond: input='/index.cgi' pattern='^/?$' =>
not-matched
[Sat Apr 19 20:40:14.582777 2014] [rewrite:trace1] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] pass through /var/www/HOSTNAME/index.cgi
[Sat Apr 19 20:40:14.583131 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] strip per-dir prefix: /var/www/HOSTNAME/index.pl ->
index.pl
[Sat Apr 19 20:40:14.583136 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] applying pattern '.*' to uri 'index.pl'
[Sat Apr 19 20:40:14.583143 2014] [rewrite:trace4] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] RewriteCond: input='/index.pl' pattern='^/?$' =>
not-matched
[Sat Apr 19 20:40:14.583146 2014] [rewrite:trace1] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] pass through /var/www/HOSTNAME/index.pl
[Sat Apr 19 20:40:14.583375 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] strip per-dir prefix: /var/www/HOSTNAME/index.php ->
index.php
[Sat Apr 19 20:40:14.583380 2014] [rewrite:trace3] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] applying pattern '.*' to uri 'index.php'
[Sat Apr 19 20:40:14.583383 2014] [rewrite:trace4] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] RewriteCond: input='/index.php' pattern='^/?$' =>
not-matched
[Sat Apr 19 20:40:14.583386 2014] [rewrite:trace1] [pid 20459]
mod_rewrite.c(468): [client 192.168.198.1:14715] 192.168.198.1 - -
[HOSTNAME/sid#7fd7ed4f0528][rid#7fd7dabcd0a0/subreq] [perdir
/var/www/HOSTNAME/] pass through /var/www/HOSTNAME/index.php

-- 
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 56434] Rewrite rule for root / matches, but end flag is ignored (subreq for index files still proceeds)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56434

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Eric Covener <co...@gmail.com> ---
mod_dir is looking for DirectoryIndex'es. There is a fix to the interaction
between the two mods in 2.4.9, can you confirm it fixes your problem?

  *) mod_dir: Don't search for a DirectoryIndex or DirectorySlash on a URL
     that was just rewritten by mod_rewrite. PR53929. [Eric Covener]

-- 
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 56434] Rewrite rule for root / matches, but end flag is ignored (subreq for index files still proceeds)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56434

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Eric Covener <co...@gmail.com> ---
thanks for verifying

*** This bug has been marked as a duplicate of bug 53929 ***

-- 
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 56434] Rewrite rule for root / matches, but end flag is ignored (subreq for index files still proceeds)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56434

--- Comment #2 from Norm <no...@gmail.com> ---
I just tried 2.4.9 and indeed the reported problem is gone. If any Ubuntu users
read this, there is a fairly actively maintained PPA at
https://launchpad.net/~ondrej/+archive/apache2 which works fine in Trusty, so
no need to compile.

-- 
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