> As an alternative, I have used a PerlFixupHandler that detects a MIME > type of text/html and for only those enables Mason leaving the rest > alone. This lets autoindexing still work properly, as well as images > and other content in the same directory. The same trick can work with > Template. The code looks like this:
I actually tried something like this after seeing it in one of your Web Techniques columns. Unfortunately, the content_type for anything in this Location is returning empty. As far as I can tell, because I'm using a Location directive but no Alias, Apache splits the URI between the directory and the file name, and thus looks at the directory when it tries to determine the filename and content_type, but puts the actual file name into path_info. That means that not only is there no corresponding file, but there's no extension on what Apache thinks is the file name, so it can't determine the content type. For example, with this config: <Location /tt> SetHandler perl-script PerlHandler Apache::Test::Mod </Location> And this URL: http://localhost/tt/index.html I get (notice the empty content_type): uri: /tt/index.html filename: c:/usr/local/apache/htdocs/tt path_info: index.html content_type: On the other hand, if I use an Alias directive and map that URI to the actual location of the template files, then Apache *can* determine the content_type. However, that eliminates the path_info that I was using as the file name in Template->process. Of course, I could always use filename instead of path_info, but that goes against Template's default rejection of absolute paths, which I assume is there for security reasons. So, with this config: Alias /tt c:/usr/local/apache/perl/tt/html <Location /tt> SetHandler perl-script PerlHandler Apache::Test::Mod </Location> And the same URL: http://localhost/tt/index.html I get (and now path_info is empty): uri: /tt/index.html filename: c:/usr/local/apache/perl/tt/html/index.html path_info: content_type: text/html Have I configured something wrong? Is this an issue only on Windows? Thanks again. -Tim
