[Maypole] content-type forced to text/html

Simon Flack sf@flacks.net
Thu, 02 Dec 2004 12:29:41 +0000


Dave Howorth wrote:
> Sebastian Riedel wrote:
> 
>> Benjamin Reed:
>>
>>> I've started setting up a simple site using maypole, but I'm running 
>>> into an annoying rendering issue in firefox because anything under 
>>> the control of maypole gets sent as "text/html", even if it's just 
>>> passing through serving a .css file to apache proper.
>>>
>>> Is there a way to tell maypole to server it's own stuff as text/html, 
>>> but for anything else to *not* set the content-type, and let apache 
>>> figure it out?
>>
>>
>> No it's not that simple, when Maypole sends you a css file it's handling
>> it like a normal TT2 template, it doesn't know it isn't.
>>
>> You can put something like this in your additional_data()
>>
>> $r->content_type('text/css') if $r->template =~ /\.css$/;
>>
>> or this in your css file. ;)
>>
>> [% request.content_type('text/css') %]
> 
> 
> Another alternative is just to make the reference to the css file an 
> absolute URL so the request for it never goes through Maypole at all.

Another option I've been mulling over is to add File::Type or 
File::MMagic to the list of dependencies, and auto-detect the mime type.

--simonflk