On Fri, 1 Dec 2006 13:12:02 -0500
carmen <_ at whats-your.name> wrote:
> im trying to figure out how to serve a favicon.ico for my app, does anyone
have a line for Mongrel::Configurator? all i can see is that everyone seems to
use the 404 handler...how boring..
>
> uri "/favico", :handler =>
Mongrel::DirHandler.new(File.dirname(__FILE__)+"/favicon.ico") is
sort of close, but it says The image ?http://m/favicon.ico? cannot be displayed,
because it contains errors. . puting the favicon into its own dir, means it ends
up at /favico/favicon.ico which isnt right either. should i be hacking up the
dirhandler to serve a static file if the pathname argument is a file not a dir?
or is there some SingleFileHandler that im missing (would like to keep the
modified header checks from DirHandler)
DirHandler, being a DIR handler and not a FILE handler, needs the directory path
that you want it to serve. In your case, just put the favicon.ico into the root
rails directory. If you''re not using rails, then change your line to:
uri "/", :handler =>
Mongrel::DirHandler.new(File.dirname(__FILE__))
Of course, if you were really really smart you''d find a way to make a
mongrel handler that generated a random favicon. :-)
--
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.zedshaw.com/
http://www.awprofessional.com/title/0321483502 -- The Mongrel Book
http://mongrel.rubyforge.org/
http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.