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 2011/12/31 01:33:19 UTC

DO NOT REPLY [Bug 52403] New: FallbackResource doesn't work for non-existent PHP files in webroot

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

             Bug #: 52403
           Summary: FallbackResource doesn't work for non-existent PHP
                    files in webroot
           Product: Apache httpd-2
           Version: 2.2.20
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_dir
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: parry@plarry.com
    Classification: Unclassified


Server info:

Linux ubuntu-server 3.0.0-14-server #23-Ubuntu SMP Mon Nov 21 20:49:05 UTC 2011
x86_64 x86_64 x86_64 GNU/Linux
Server version: Apache/2.2.20 (Ubuntu)
PHP 5.3.6-13ubuntu3.3 with Suhosin-Patch (cli) (built: Dec 13 2011 18:18:37) 

I am using the default apache website except that I have the "FallbackResource
/index.php" configured under <Directory /var/www/>. The fallback to the
index.php seems to work great EXCEPT when I request a non-existent PHP file
from the webroot directory. Any other file extension works fine in the webroot
but any filename with the .php extension gets a 404 error response. If I call
that non-existent PHP file from a bogus/non-existent directory, it works.

For example:
GET /a.php <--404 Error
GET /bogus/a.php <--Falls back to /index.php
GET /a.html <--Falls back to /index.php

See output below:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /a.php HTTP/1.1
HOST: localhost
Connection: close

HTTP/1.1 404 Not Found
Date: Sat, 31 Dec 2011 00:21:54 GMT
Server: Apache/2.2.20 (Ubuntu)
Vary: Accept-Encoding
Content-Length: 278
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /a.php was not found on this server.</p>
<hr>
<address>Apache/2.2.20 (Ubuntu) Server at localhost Port 80</address>
</body></html>
Connection closed by foreign host.


Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /nodir/a.php HTTP/1.1
HOST: localhost
Connection: close

HTTP/1.1 200 OK
Date: Sat, 31 Dec 2011 00:22:11 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.3
Vary: Accept-Encoding
Content-Length: 25
Connection: close
Content-Type: text/html

/nodir/a.php
localhost
Connection closed by foreign host.



Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /a.html HTTP/1.1 
HOST: localhost
Connection: close

HTTP/1.1 200 OK
Date: Sat, 31 Dec 2011 00:32:38 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.3
Vary: Accept-Encoding
Content-Length: 20
Connection: close
Content-Type: text/html

/a.html
localhost
Connection closed by foreign host.


Thanks,
Parry

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


[Bug 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29501|1                           |0
           is patch|                            |
  Attachment #29501|0                           |1
        is obsolete|                            |

--- Comment #3 from Christophe JAILLET <ch...@wanadoo.fr> ---
Comment on attachment 29501
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29501
Proposed patch

Grrr, bugzilla will turn me crazy...
Why does it change the bug you are working on by its own ????

The patch is related to PR53402

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

--- Comment #4 from Spencer Rinehart <an...@overthemonkey.com> ---
I believe this is due to mod_dir.c line 366
(https://github.com/apache/httpd/blob/trunk/modules/mappers/mod_dir.c#L366),
although I'm not positive.  I'd like to see this fixed, and am willing to
contribute, but I'm unsure exactly what change needs to be made.

The comment says that the (r->finfo.filetype == APR_NOFILE) check means that
there is nothing in the filesystem, but that doesn't seem to be the case for
nonexistant php files when the request specifies the .php extension.

Is the issue that the filetype should be getting set to APR_NOFILE in this case
but isn't?  Or is it the check that is incorrect: is checking for APR_NOFILE
not the correct way to check that the file doesn't exist?

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

Spencer Rinehart <an...@overthemonkey.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anubis@overthemonkey.com

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

--- Comment #1 from Parry <pa...@plarry.com> 2011-12-31 02:40:26 UTC ---
I am able to get this working correctly using mod_rewrite with the following
basic lines in .htaccess but would obviously prefer the FallbackResource
instead:

(.htaccess in webroot)
RewriteEngine On
RewriteCond /var/www/%{REQUEST_FILENAME} !-f
RewriteCond /var/www/%{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /a.php HTTP/1.1
HOST: localhost
Connection: close

HTTP/1.1 200 OK
Date: Sat, 31 Dec 2011 02:37:48 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.3
Vary: Accept-Encoding
Content-Length: 43
Connection: close
Content-Type: text/html

/a.php
localhost

Connection closed by foreign host.

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


[Bug 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

--- Comment #2 from Christophe JAILLET <ch...@wanadoo.fr> ---
Created attachment 29501
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29501&action=edit
Proposed patch

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

Nicolas Toniazzi <ni...@toniazzi.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nicolas@toniazzi.net

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

--- Comment #6 from Richard George <ri...@phase.org> ---
FWIW the OSX problem only happens on *desktop* OSX, it was also tested on iOS
devices where it worked fine, and on a Windows 7? laptop it also loaded fine.

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

--- Comment #5 from Richard George <ri...@phase.org> ---
This (or a very similar) issue causes OSX clients ONLY to fail to connect to
virtual hosts configured with any DirectoryIndex line together with a
FallbackResource line, unless "DirectoryIndex disabled" is used.

This has been tested with the following clients:

OSX 10.9.4 Firefox 30.0                 - FAILS
OSX 10.9.4 Safari 7.0.5                 - FAILS
OSX 10.9.4 command-line telnet port 80  - FAILS

Ubuntu 14.04 links (command-line browser) - WORKS
Ubuntu 14.04 command-line telnet port 80  - WORKS
Windows 7 Firefox 30.0                    - WORKS

All working machines were VirtualBox VMs inside the OSX boxes. When the page
loads, it loads instantly, when it fails, it never connects and eventually
times out.

The following server config shows the problem. Server is Ubuntu 14.04 64 bit,
Apache 2.4.7-1ubuntu4 on an AWS EC2 t2.small instance

<VirtualHost *:80>
        ServerName tdd-deciphered.com
        ServerAlias tddd.ec2.phase.org

        ServerAdmin webmaster@localhost

#  OSX clients cannot connect when these DirectoryIndex directives are missing
        DirectoryIndex disabled
        DirectoryIndex index.php

        DocumentRoot /home/wechsler/repos/tdd-deciphered/web/
        <Directory />
                Options +FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/wechsler/repos/tdd-deciphered/web>
#  OSX clients cannot connect when this directive is used
#               DirectoryIndex index.html index.php
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted

                FallbackResource /index.php
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/tdd-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/tdd-access.log combined
</VirtualHost>

This particular issue would appear to be a doozy of an edge case

-- 
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 52403] FallbackResource doesn't work for non-existent PHP files in webroot

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

Adam Monsen <ha...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |haircut@gmail.com

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