Project

General

Profile

Actions

Bug #2456

closed

Why is server.error-handler-404 serving 200 instead of 404?

Added by sdan about 12 years ago. Updated over 8 years ago.

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

Description

In lighttpd.conf I ahve
server.error-handler-404 = "/error.htm"

File exists, it is served ok, but the server returns 200 instead of 404 when we request an non existent url.
Please make a fix, because it breaks lots of development tools.

Please not the setting server.errorfile-prefix does not fix the problem.
server.errorfile-prefix = "/wheel/www/www.ejobs.ro/static/status-"

curl -I http://domain.com/nonexistent.html
HTTP/1.1 200 OK
Expires: Fri, 16 Nov 2012 07:36:22 GMT
Cache-Control: max-age=691200
Content-Type: text/html
Accept-Ranges: bytes
ETag: "2885349903"
Last-Modified: Mon, 16 Jan 2006 21:30:01 GMT
Content-Length: 6
Date: Thu, 08 Nov 2012 07:36:22 GMT
Server: httpd

Actions #1

Updated by stbuehler about 12 years ago

  • Status changed from New to Invalid
  • Target version deleted (1.4.32)

Just because it doesn't do what you want it to doesn't mean it is a bug; also changing such behavior in a stable branch would be bad.
The fact that the "bug" title contains a question mark indicates that you should have used the support forum instead.

that said: server.error-handler-404 was intended as a "rewrite-if-file-does-not-exist", so 200 is ok.
also we now recommend to use exactly this: url.rewrite-if-not-file = (...)

server.errorfile-prefix is provided to change the html that is displayed for errors, not to handle the errors; to not loop in errors only static files are supported for this.

Actions #2

Updated by sdan about 12 years ago

  • Status changed from Invalid to Reopened

What I ask is a normal behavior.
We use lighttpd for serving static contents, no mod_rewrite, no mod_fastcgi, light as possible.
Please be more flexible because in the future you will lose lots of users.
Please give us an fix to give error 404 when the url is invalid.

Actions #3

Updated by stbuehler about 12 years ago

  • Status changed from Reopened to Invalid
Actions #4

Updated by sdan about 12 years ago

  • Status changed from Invalid to Reopened

Please give us a solution.
Invalidating this bug is not an answer.

Actions #5

Updated by stbuehler about 12 years ago

  • Status changed from Reopened to Invalid

Yes it is.

Actions #6

Updated by gstrauss over 8 years ago

server.errorfile-prefix preserves the HTTP error status code when returning a static file error page in the HTTP response.

@sdan, if that is not what you're seeing, then please check your configuration. server.error-handler-404 (if set) takes precedence over server.errorfile-prefix for error codes 403 and 404, so please ensure that server.error-handler-404 is not set in your configuration if you are using server.errorfile-prefix to handle 403 and 404 pages.

@stbuehler, https://redmine.lighttpd.net/projects/1/wiki/Server_error-handler-404Details description of server.error-handler-404 includes:

You can use a dynamic or static page for the handler. If you use a static page, the server will return a 404 HTTP status code with the content of your static page.

so it is easy to see how people might be confused when server.error-handler-404 returns 200 OK for static pages from error handler. I have updated the wiki documentation. Would you please take a look and review the change?

Actions

Also available in: Atom