lighttpd:404页面不返回404状态
我正在使用 lighttpd 404 错误处理程序和静态 404 页面。整个conf文件看起来像这样:
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$" => "/blog/",
// various individual redirects
)
}
$HTTP["scheme"] == "https" {
$HTTP["url"] !~ "^/blog/admin/" {
url.redirect = ( "^/(.*)" => "http://www.mysite.com/$1" )
}
}
但是,当我访问一个应该是404的地址时,我确实正确地看到了我们的404页面,但状态代码是200。
lighttpd 文档 说如果使用静态页面,您应该获得 404 状态代码。
我认为我们正在使用静态页面,但是我们重定向的方式是否意味着我们实际上不是静态页面?
抱歉新手问题。
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$" => "/blog/",
// 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用
server.errorfile-prefix
修复了此问题 - 认为这只是server.error-handler-404
中的一个错误。似乎是某些版本的lighttpd 中的已知错误。我实际上使用的是比 1.4.17 更高的版本,但仍然遇到同样的问题。
Fixed this by using
server.errorfile-prefix
instead - think it is simply a bug inserver.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.