[Dancer-users] Serving DirectoryIndex via Dancer fails

David Precious davidp at preshweb.co.uk
Thu Mar 17 15:31:51 CET 2011

On Thu, 2011-03-17 at 08:49 -0500, Mr. Puneet Kishor wrote:
> My httpd.conf is set to serve DirectoryIndex index.html and index.cgi. 

httpd.conf is irrelevant to Dancer's behaviour.

> Yet, if I go to [http://punkish.org/geoweb] or [http://punkish.org/opengov], Dancer 
> thinks I am trying to query for a page called geoweb or opengov -- I was under the 
> impression that it would first see if by adding a trailing slash to the requested 
> URI, it could located static directory.

It'll simply look for a matching file and serve it if found.  Dancer's
static file serving is designed simply to serve up static files
(images/CSS/Javascript etc) for a dynamic Dancer-powered web-app, not
really to be a webserver to replace Apache/Nginx etc.  In fact, for a
busier site, I'd recommend configuring e.g. Nginx in front of the Dancer
app to serve up the static files itself, and only pass through the
requests which actually need to be handled by the Dancer app.

I don't personally think that Dancer's static file serving should be
extended to support DirectoryIndex etc; when you start to need that sort
of thing, you should probably let a proper web server do it.

Why not just configure Apache to serve those specific static sites
itself, rather than involving Dancer in it?


Dave P

David Precious  ("bigpresh")

   "Programming is like sex. One mistake and you have to support
   it for the rest of your life". (Michael Sinz)

More information about the Dancer-users mailing list