Project

General

Profile

Actions

Bug #2493

closed

fastcgi.map-extensions = (".html" => ".php") - Gives 404 -- but sends over data to client?

Added by Torxed almost 11 years ago. Updated almost 11 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_fastcgi
Target version:
-
ASK QUESTIONS IN Forums:

Description

Ok so some facts to begin with:

  • OpenBSD 5.3
  • AJAX can't load content because of the 404 (even tho the content is sent over)
  • lighttpd/1.4.32 (ssl) (Feb 26 2013 08:38:09)
  • php-5.3.21
  • php-fastcgi-5.3.21
  • uncommented cgi.fix_pathinfo=1 in /etc/php-5.3.ini
  • starting php with: /usr/local/bin/php-fastcgi-5.3 -b 127.0.0.1:9123
  • starting lighttpd with: /usr/local/sbin/lighttpd -f /etc/lighttpd.conf

Currently only have both php installed because i needed the php.ini example file and it only comes with php-5.3.21 for some reason.

And here's where I'm at now (the full problem description and "how did i get here" can be found at http://stackoverflow.com/questions/17687671/jquery-get-news-html-404-not-found )

And here's the actual issue:

Request URL:http://127.0.0.1/News.html
Request Method:GET
Status Code:404 Not Found

Request Headers

Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:127.0.0.1
Referer:http://127.0.0.1/index.php
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36
X-Requested-With:XMLHttpRequest

Response Headers

Content-type:text/html
Date:Tue, 16 Jul 2013 21:55:05 GMT
Server:lighttpd/1.4.32
Transfer-Encoding:chunked
X-Powered-By:PHP/5.3.21

But the content renders..
And here's where i'm at now, don't know what's causing this or what's wrong at all.

PHP pages work, they are parsed if requested but the header is missgiving, headers say 404 but the content is loaded as it should...

I found an old issue with the exact same issue as i'm experiencing:
http://redmine.lighttpd.net/issues/2045#change-6274

I posted in the forum but that part appears dead (barely any responses at all)


Files

lighttpd.conf (10.8 KB) lighttpd.conf Torxed, 2013-07-17 15:21
php-5.3.ini (87.5 KB) php-5.3.ini Torxed, 2013-07-17 15:22
fcgi_app.py (15.3 KB) fcgi_app.py Python FastCGI client Torxed, 2013-07-18 14:01
Actions #1

Updated by patrickdk almost 11 years ago

Why would you file a bug about your own configuration issue?

It returns 404, cause it was told to.

Using fastcgi html => php is not a supported rewrite/redirect method, so it's doing exactly what it should.

As you commented on the other bug, that said all this also.

Actions #2

Updated by Torxed almost 11 years ago

Because i did not configure it to do so?
And the documentation on html => php is not really well documented, the mapping function is barely mentioned considering all the other documentation.

All i want lighttpd to do, is treat html files as if it was a php file.
Hence i disabled static file transfer for html files and tell it to send it to php, or at least i thought i did until lighttpd gives me mixed results.

I get the content, why wouldn't i get the proper header?
I havn't explicitly configured lighttpd to do anything, i mainly run on a default config.

It's worth pointing out, even pure .php files get this error too!

Actions #3

Updated by Torxed almost 11 years ago

I've also configured:

; if cgi.nph is enabled it will force cgi to always sent Status: 200 with
; every request. PHP's default behavior is to disable this feature.
cgi.nph = 1

This forces PHP to always return a 200 status code, which LIGHTTPD DOES NOT HONOR.. gha this is a real PITA..

Actions #4

Updated by Torxed almost 11 years ago

And here's the detailed error log:

https://gist.github.com/Torxed/6028350

Also a screenshot of this shitty mess, Since i'm almost convinced PHP always returns 200 i'm flipping out here, there's no reason why lighttpd should respond with 404

Actions #5

Updated by Torxed almost 11 years ago

# python fcgi_app.py

{'FCGI_MAX_CONNS': '1', 'FCGI_MPXS_CONNS': '0', 'FCGI_MAX_REQS': '1'}

Since i'm not to deep into the FastCGI protocol i can't make a proper request for a file, i can only get configured parameters and see what the servers allows me to do but the server works and treats me well enough to give me the configured parameters that it should.. So, lighttpd? Considering all evidence points towards that PHP works as it should IMO. If i'm wrong tell me why and don't give me some standard bullshit that "you configured it wrong", tell me where it's wrong and why it would matter so i can fix it, until then lighttpd is broken by design.

Actions #6

Updated by stbuehler almost 11 years ago

Given that we never received such report on linux and other systems, it should be obvious that everyone is blaming your platform (and you/your config, because windows users are usually not considered that qualified around here).
Also we have a test suite that would catch this error if it happened all the time.
But I agree that this looks like a bug, and quite possibly in lighttpd, so I won't close it as invalid.

So.

I just checked the current source and didn't see anything that might set 404 if the request gets handled by fastcgi. I'm not sure how you got your binary, so I have no idea whether you're using a modified source. (I also don't know what wlmp-project.net is patching - the site lists some 3rd party modules which I think require core changes.)

If you were on a sane system I'd ask you to get a strace of lighttpd, then we would see what it reads from the FastCGI backend, or use tcpdump/wireshark to capture traffic (but windows wireshark can't capture loopback traffic...). So your debug methods are limited, and no developer is interested to test on windows.

If you can tell us where the bug in lighttpd is, we ofc will try to fix it. But from the data we have there is not much we can do apart from reading the source (that might not even be the source you are using).

You also asked how you can fix it: use a sane platform. lighttpd won't perform well on windows anyway (due to using select() as fdevent backend), so just install some linux dist in a VM (or on dedicated hardware).

If you really think that because of this bug or peoples reaction to it "lighttpd is broken by design" I ask you to leave us alone, thx.

Actions #7

Updated by stbuehler almost 11 years ago

Oh, you failed to mention that you got a quite helpful answer on stackoverflow, which indicates the bug might be as well in php/your php config.

And sorry that i associated your problem with windows, but your first question was in a "windows" bug report.

Actions #8

Updated by Torxed almost 11 years ago

Sorry for reporting this as a Windows bug.
Didn't see any other options. And no that helpful answer is not helpful, it doesn't even reflect my specific system and/or log messages (I don't get that in my logs).

Anyway yea i've been going about this for a few days now and i've more or less spammed that StackOverflow thread with "hows" and "what if's".

And i'm sorry for bashing lighttpd, you were correct. This is a PHP issue and lighttpds is honoring PHP's status code.
However i tend to not take lightly when people say "it is so" without being able to confirm it in any way.. so i wrote (and found) a FastCGI client in Python giving back raw data from the FastCGI server, i'll attach it.

And with "broken by design" i meant that it didn't honor PHP's status codes when using the FastCGI protocol, again.. i had no way of testing it and it was merely an assumption that this was the case, again I'm sorry for stepping on touchy toes.

The issue can be closed btw as a result of this new discovery.

Actions #9

Updated by stbuehler almost 11 years ago

  • Status changed from New to Invalid
  • Target version deleted (1.4.x)
Actions

Also available in: Atom