Search code examples
common-lisphunchentoot

Removing default items from Hunchentoot server


Hunchentoot comes with some default files that it serves without having any new handlers added. They are stored in /path/to/hunchentoot/www/. I can't figure out how to stop them from being served. I've tried looking at *dispatch-table* and *easy-handler-alist* but nothing is there, and I can't find a way to remove them anyway. Is there a way to at least make it 404 when one of those pages is requested without removing all the files from that directory (which would get restored on update)?


Solution

  • These files are found through the value of the acceptor's document-root slot. You can override this when creating the acceptor:

    (make-instance 'hunchentoot:easy-acceptor :port 8080 :document-root "/my/docs/")
    

    Just point that into an empty directory to serve nothing by default.

    If necessary, the error page templates that are located in www/errors/ can be read from elsewhere by setting the error-template-directory slot in a similar way.