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/08/23 02:12:55 UTC

[Bug 56883] New: multiviews option causes a fail in ModRewrite

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

            Bug ID: 56883
           Summary: multiviews option causes a fail in ModRewrite
           Product: Apache httpd-2
           Version: 2.4.10
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: eugenia@linux.com

When the option MultiViews sets it has priority on rewrite rule.
When MultiViews option sets at the root Directory and AllowOverride is On, the
RewriteRule ^ whatever.php not works if the URI contains a part of an existing
filename. By example:
/something go to whatever.php but /existing-filename go to the
existing-filename.php instead of going to whatever.php

If MultiViews is not set, then RewriteRule !(^static) whatever.php works but it
impede the negotiation content on static directory even if MultiViews sets on +
at the <Directory /something/static>

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

Eugenia Bahit <eu...@linux.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |major

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #9 from Eugenia Bahit <eu...@linux.com> ---
Yes, the error.log shows an error like that. It's very true.
I had not tried changing (or copy) the apache configuration file from 2.2 to
2.4. Neither I had tried with different distros. That is my fault :(
So, it's not an Apache bug, then. The problem is that the Apache package from
Ubuntu repository not come with the default Apache configuration file. It comes
with an "Ubuntu" configuration. I hurried to getting a conclusion. Sorry to
have wasted your time and thank you so much for your dedication.
I will changing the Apache configuration file :)

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #4 from Eugenia Bahit <eu...@linux.com> ---
(In reply to Eric Covener from comment #3)
> It's difficult to follow what your expectation or even observations are for
> the interaction between the two modules when both are enabled.  A more
> self-contained example would help.
> 
> Do things work better more as you expect if your rewriterules are not in
> htaccess/directory context?

I'm sorry. My english is not good. I'm not sure if understand your answer but I
will try to explain the problem again with an example.

Until Apache 2.4, if you put at your VirtualHost the following instructions:
<Directory /path/to/application/root>
    Options -Indexes FollowSymLinks MultiViews
    RewriteEngine On
</Directory>
And then, in the .htaccess of /path/to/application/root writing this rule:

RewriteEngine On
RewriteRule ^ controller.php

All, absolutely all petitions go to controller.php without exceptions.

Since Apache 2.4 the same instructions and the same rewrite rules at the same
places causes that all petitions go to controller.php but with some exceptions.
By example:

Until Apache 2.4, /something-like-that go to controller.php always.

Since Apache 2.4, /something-like-that go to controller.php if not exists a
file called something-like-that (.something like .php or .html, etc).

If exists a file called something-like-that, Apache 2.4.x generates an error
404 not found. But if you entering /something-like-that.extension in the URL,
go to something-like-that.extension instead of controller.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 56883] multiviews option causes a fail in ModRewrite

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

Eugenia Bahit <eu...@linux.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #10 from Eugenia Bahit <eu...@linux.com> ---
Eric, I try again by copying the Apache configuration file from my own
configuration in 2.2 to a clean installation in 2.4 and the problem persists.
The problem is real and is independent of the Linux distro.We talking about of
an identical configuration in both versions on clean installations.
It's not resolved to me. I'm seeing the problem when (insist) MultiViews is
present at the Directory tag and AllowOverride is on (set it like "All").

How do you explain that mod_negotiation in Apache 2.2 not trying to resolve the
URI if mod_rewrite is active and it (mod_rewrite) can resolve it and then, in
Apache 2.4 is mod_negotiation who try to resolve the same URI and if it can't
ending all without intervention of mod_rewrite? I understand the 404 error but
it is only a simple consequence of previous description.

Like you said yesterday, I thought I was wrong. But today, after new several
tests, the problem persist. So, I insist in that it is a 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 56883] multiviews option causes a fail in ModRewrite

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

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

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

--- Comment #6 from Eric Covener <co...@gmail.com> ---
I cannot really see any misbehavior, any idea where the recreate is wrong?

Alias /PR56883 /tmp/PR56883
<Directory /tmp/PR56883>
AllowOverride none
Options +MultiViews
require all granted
RewriteEngine on
RewriteCond %{REQUEST_URI} !=/PR56883/other.html
RewriteRule ^ /PR56883/other.html
</directory>

$ wget -q http://localhost/PR56883/index -O-
<html><body><h1>other.html<h1></body></html>
$ wget -q http://localhost/PR56883/other -O-
<html><body><h1>other.html<h1></body></html>
$ wget -q http://localhost/PR56883/XXX -O-
<html><body><h1>other.html<h1></body></html>
$ ls -1 /tmp/PR56883/
index.html
other.html

When I disable mod_rewrite, negotiation works for the first two URL's as
expected.

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #3 from Eric Covener <co...@gmail.com> ---
It's difficult to follow what your expectation or even observations are for the
interaction between the two modules when both are enabled.  A more
self-contained example would help.

Do things work better more as you expect if your rewriterules are not in
htaccess/directory context?

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

Eugenia Bahit <eu...@linux.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #12 from Eugenia Bahit <eu...@linux.com> ---
(In reply to Eric Covener from comment #11)
> AFAICT 2.2 behaves the same if you enable multiviews, the prefix exists, but
> the file on-disk does not have a known mimetype (see e.g. MultiViewsMatch). 

Sorry Eric but this is not a problem, because yes that it have a known
mimetype.
The MIME type is not the problem. Therefore I said before that I tested with
the same configuration (including the declarations of MIME types).

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

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

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

--- Comment #8 from Eric Covener <co...@gmail.com> ---
Were you getting this error-level message the entre time? It would have been
helpful to include it if so:

[Mon Aug 25 21:33:47.276658 2014] [negotiation:error] [pid 3997:tid
140044101080832] [client 127.0.0.1:47304] AH00687: Negotiation: discovered
file(s) matching request: /var/www/myapp/public/bar (None could be negotiated).

---
    /* We found some file names that matched.  None could be served.
     * Rather than fall out to autoindex or some other mapper, this
     * request must die.
     */
    if (anymatch && !neg->avail_vars->nelts) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                      "Negotiation: discovered file(s) matching request: %s"
                      " (None could be negotiated).",
                      r->filename);
        return HTTP_NOT_FOUND;
    }
---

Your scenario worked for me when I told httpd that .php had some mime type so
mod_negotiation would temporarily negotiate it.  That's why my HTML test
worked.

For me, 2.2 behaved no differently.  Maybe your 2.2 config just has a different
set of types configured.

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #11 from Eric Covener <co...@gmail.com> ---
AFAICT 2.2 behaves the same if you enable multiviews, the prefix exists, but
the file on-disk does not have a known mimetype (see e.g. MultiViewsMatch).   

I don't know what compiled-in defaults or behaviors might differ, but there
were no obvious ones to me.

If you have the requirement to use negotiation, rewrite, and extensions that
don't have mimetypes you'll need to arrange for negotiation not to fail
(multiviewsmatch any, addtype, etc).

I'd suggest consulting the users mailing list or serverfault.com for further
discussion, bugzilla is strictly to record bugs against httpd.

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #1 from Eugenia Bahit <eu...@linux.com> ---
Sorry, when I said "but /existing-filename go to the existing-filename.php" I
should say "but /existing-filename.php go to the existing-filename.php but
/existing-filename causes an error 404 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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #7 from Eugenia Bahit <eu...@linux.com> ---
(In reply to Eric Covener from comment #6)
> I cannot really see any misbehavior, any idea where the recreate is wrong?
> 
> Alias /PR56883 /tmp/PR56883
> <Directory /tmp/PR56883>
> AllowOverride none
> Options +MultiViews
> require all granted
> RewriteEngine on
> RewriteCond %{REQUEST_URI} !=/PR56883/other.html
> RewriteRule ^ /PR56883/other.html
> </directory>
> 
> $ wget -q http://localhost/PR56883/index -O-
> <html><body><h1>other.html<h1></body></html>
> $ wget -q http://localhost/PR56883/other -O-
> <html><body><h1>other.html<h1></body></html>
> $ wget -q http://localhost/PR56883/XXX -O-
> <html><body><h1>other.html<h1></body></html>
> $ ls -1 /tmp/PR56883/
> index.html
> other.html
> 
> When I disable mod_rewrite, negotiation works for the first two URL's as
> expected.

Eric, I think that your recreation could be out of the context that I exposed.
I'm not sure. But if you want to recreate the problem, please, try this:

1) create the virtual host file (or edit it) with the following code:
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /var/www/myapp/public

    <Directory /var/www/myapp/public>
        Options -Indexes +MultiViews
        AllowOverride All
    </Directory>

    ErrorLog /var/www/myapp/error.log
    CustomLog /var/www/myapp/access.log combined

</VirtualHost>


2) create only 3 files: foo.php, bar.php and .htaccess and redirect all
petitions to foo.php:


mkdir -p /var/www/myapp/public
echo "Foo" > /var/www/myapp/public/foo.php
echo "Bar" > /var/www/myapp/public/bar.php
echo "RewriteEngine On" > /var/www/myapp/public/.htaccess
echo "RewriteRule ^ foo.php" >> /var/www/myapp/public/.htaccess

3) Now, try to get http://localhost, http://localhost/whatever and
http://localhost/bar. The last URI get an error 404.

4) But now, create a file called bar.html and try to get http://localhost/bar
again. Now works but this is not logic.

5) Remove bar.html and try to supress MultiViews from Virtual Host. Restart
Apache and try again. Now works.

At the following link, I copied stdout from some tests made:
http://cursos.eugeniabahit.com/pastebin/codigofuente/ver/24

I hope this, can help to understand the problem.

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #5 from Eugenia Bahit <eu...@linux.com> ---
Sorry again. I get confused a lot when I write in other language.
<Directory /path/to/application/root>
    ....
    RewriteEngine On <-- NO! AllowOverride All
</Directory>

-- 
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 56883] multiviews option causes a fail in ModRewrite

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

--- Comment #2 from Eric Covener <co...@gmail.com> ---
This bug is marked as a regression. Where is it a regression from?

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