Project

General

Profile

What is the proper syntax for server.error-handler in 1.4.45

Added by brianddk over 5 years ago

I had hoped to use server.error-handler to try to have one error file for all > 400 response codes. I suspect using server.errorfile-prefix will require I make a lot of symlinks for all codes > 400.

My conf annotated with "works/fails".

server.modules = (
        "mod_alias",
        "mod_redirect",
        "mod_proxy",
)

server.document-root        = "/var/www/html" 
#server.error-handler       = "/var/www/html/404.html" # <= Fails @v1.4.45, get 404 but no 404.html content
#server.error-handler       = "/404.html"              # <= Fails @v1.4.45, get 404 but no 404.html content
server.errorfile-prefix     = "/var/www/html/"         # <= Works @v1.4.45, get 404 and all 404.html content
#server.error-handler-404   = "/404.html"              # <= Works @v1.4.45, get 200 and all 404.html content

SysInfo

  • Ubuntu 18.04.1 LTS (Bionic Beaver)
  • Kernel 4.15.0-1021-gcp x86_64 (packaged with bionic)
  • lighttpd 1.4.45-1ubuntu3 bionic in /usr/sbin
  • Client: Chrome Version 69.0.3497.100 (Official Build) (64-bit)
  • Client: Tor Browser 8.0.1
  • Client: lynx/bionic,now 2.8.9dev16-3 amd64
  • Client: dillo/bionic,now 3.0.5-4build1 amd64
  • Client: seamonkey-mozilla-build/stable,now 2.49.4-0ubuntu1 amd64

Replies (3)

RE: What is the proper syntax for server.error-handler in 1.4.45 - Added by gstrauss over 5 years ago

An error handler that handles all error codes is intended to be dynamic, since otherwise it can not handle the codes differently, including the inability to put the precise error code in the content body. "Something went wrong" without any further details to share in a problem report is not what I consider user-friendly.

Regardless, I'll add a patch to lighttpd 1.4.51 to handle this case, even though I consider it a poor choice.

RE: What is the proper syntax for server.error-handler in 1.4.45 - Added by brianddk over 5 years ago

Agreed, it's a kludge, but for my needs all I really wanted was an "opps.html" page. Since the status code is forwarded I'll just tell the interested visitors to inspect the HTTP code returned on the get for more info. I'll look at doing some cgi to be a bit more clever in the future, but this was kinda a catch all.

Thx for considering the patch.

RE: What is the proper syntax for server.error-handler in 1.4.45 - Added by gstrauss over 5 years ago

See commit 98f5cc6f and I recommend lighttpd 1.4.51 (just released)

Also, you might consider using server.error-intercept = "enable" if you want to intercept errors returned from the proxy backend (in an attempt to control information leakage if the backend might include sensitive info in error pages)

    (1-3/3)