jekyll/jekyll — pull request #1899 by soimort (2014-01-01 21:15:18+00:00)
Title: Routing 404 errors to custom 404 page for development server

Currently the development server of Jekyll (WEBrick) does not handle 404 errors properly, i.e., it displays only WEBrick's default 404 message, rather than user's custom 404 page.

People use their custom 404 pages configured in `.htaccess`, or just `404.html` ( as GitHub Pages default). It would be nice if Jekyll's preview server is aware of these.

It's a monkey patch to add a new `create_error_page` method so that `HTTPResponse` used by `HTTPServlet::FileHandler` will call this method to replace its default error page. It reads the `ErrorDocument 404` configuration in `.htaccess` first, defaults to `/404.html` (as used by GitHub Pages) then. While the custom 404 page does not exist, it simply serves WEBrick's default 404 message.