httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Jacobfeuerborn <denni...@conversis.de>
Subject Re: [users@httpd] No Content-Type header despite DefaultType directive
Date Tue, 06 Dec 2011 10:55:59 GMT
On 12/06/2011 11:13 AM, Tom Evans wrote:
> On Mon, Dec 5, 2011 at 3:08 PM, Dennis Jacobfeuerborn
> <dennisml@conversis.de>  wrote:
>> Hi,
>> I am trying to get Apache to send a file with the filename "test" that
>> contains html through a filter for the mime type text/html. The problem is
>> that even when I set a DefaultType in .htaccess the response doesn't contain
>> a Content-Type header. The browser actually displays the content as html
>> (probably by guessing) but since the response itself doesn't contain an
>> explicit mime type the filter does not get applied.
>>
>> Shouldn't Apache always set a mime type when I use DefaultType?
>>
>> Regards,
>>   Dennis
>>
>
> Are you sure it doesn't set the type, and just not run it through the filter?
>
> There is a big warning on AddOutputFilterByType that it will not fire
> if the type is determined from DefaultType.
>
> http://httpd.apache.org/docs/2.2/mod/core.html#addoutputfilterbytype

There is not Content-Type header in the response so it's not just the 
filter issue. I noticed though that DefaultType is deprecated in 2.3 and 
does nothing so that will not work anyway.

Now I'm wondering how I can best implement such a behavior myself. One idea 
is to implement a filter that checks if the Content-Type header is not set 
to simply insert it as let's say "text/html". The question is if that would 
result in the "real" filters defined for "text/html" actually processing 
the response.
If I have two filters A and B in a FilterChain and A manipulates the 
Content-Type does filter B then process the response based on that change?
My expectation would be that it does.

Does this sound like a reasonable approach?

Why was the DefaultType directive deprecated and why didn't 
AddOutputFilterByType operate on responses that had their type set using it?

Regards,
   Dennis

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message