开发者

lighttpd: 404 page does not return 404 status

开发者 https://www.devze.com 2023-04-06 21:12 出处:网络
I\'m using a lighttpd 404 error handler, with a static 404 page. The entire conf file looks like this:

I'm using a lighttpd 404 error handler, with a static 404 page. The entire conf file looks like this:

server.document-root = "/home/www/local/www/mysite/html"
url.rewrite = (
  "^(.*)/($|\?.*)" => "$1/index.html",
  "^(.*)/([^.?]+)($|\?.*)$" => "$1/$2.html"
)
server.error-handler-404 = "/404.html"
$HTTP["scheme"] == "http" {
  url.redirect = ( "^/blog.html$" => "/bl开发者_运维技巧og/",
       // various individual redirects
  )
}
$HTTP["scheme"] == "https" {
  $HTTP["url"] !~ "^/blog/admin/" {
    url.redirect = ( "^/(.*)" => "http://www.mysite.com/$1" )
  }
}

However, when I go to an address that should 404, I do correctly see our 404 page, but the status code is 200.

The lighttpd docs say that you should get a 404 status code if using a static page.

I think we're using a static page, but could something about the way we're redirecting mean that we're actually not?

Sorry for the newbie question.


Fixed this by using server.errorfile-prefix instead - think it is simply a bug in server.error-handler-404.

Seems to be a known bug in some versions of lighttpd. I was actually using a later version than 1.4.17, but still seeing the same problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号