lighttpd isn’t beautiful when it shows the user that a file is not available.
When I wrote it I want to make sure to don’t show any information that might be used for XSS attacks like displaying the URL unencoded, show local paths, … something like that. I used the simplest approach: Just show the status.
This is not pretty, but works. But I assume you want something more sexy.
There are two ways to handle the output of a error page.
The first is used to use a local, static file as the payload for the status pages.
- create a directory
- put into that directory a file name
- set server.errorfile-prefix do the directory name including the trailing slash
The file has to be a static HTML file (no PHP, …). thinking If you already have a set of nice looking error-pages perhaps you can provide them for other users. The lighty-errorpage-theme-packages.
The other way is to use the error-handler which only works for the file-not-found case. The job of the error-handler is to do something intelligent with the request. Possible use-cases are:
- Use http://www.example.org/search%20term as the direct entry to the search-page like in http://php.net/upload
- Use http://www.example.org/cached-page to do simple caching. If the requested file doesn’t exist, let the handler generate it. The next request will get the static version.
This makes it pretty flexible.