httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Lewis <>
Subject Re: Determining mimetype of document
Date Fri, 08 Jun 2012 21:35:54 GMT
On 06/08/2012 03:23 PM, Joshua Marantz wrote:
> In understand any module *can* set content-type late: I'm just wondering if
> that happens with any frequency.  E.g.when I googled for how to set
> content-type in Apache, I got references to AddType and some hacks using
> mod_rewrite, both of which would run upstream of my filter.  My main
> concern is mod_headers since it runs downstream.

It shouldn't happen very often at all unless you are using third party 

> RE firefox sniffing content-type:  does that imply that if there is an
> explicit mimetype it will ignore it and determine XHTML vs HTML via
> sniffing, I suppose, for DOCTYPE?  Do you have a link to that bit of news?
>   That certainly complicates things.

Unfortunately, I don't.  We made the "discovery" when we were setting up 
a Firefox-vs-Chrome test a few months ago (it was a corporate practical 
joke), and ended up chalking it up to programmer error.  Right now, I'm 
not even remembering what the exact header when we ran into the 
problem.  Firefox worked, Chrome didn't and we thought it was a problem 
in Chrome - but ultimately found we were submitting a bad header and 
Firefox ignored it.  When we used the right header, Chrome was working, too.


> -Josh
> On Fri, Jun 8, 2012 at 5:16 PM, Joe Lewis<>  wrote:
>> On 06/08/2012 03:07 PM, Joshua Marantz wrote:
>>> Hi,
>>> I'm trying to figure out whether my filter, which currently runs upstream
>>> of mod_headers, is likely to see the correct mimetype
>>> in request->content_type.
>>> In particular, we need to know whether browsers will interpret the content
>>> as XHTML or HTML, which is determined by the mimetype.  Do people
>>> typically
>>> set the mimetype using mod_headers, or is that typically set using AddType
>>> or some other mechanism?
>> It's usually set by the content generator.  However, you have to keep in
>> mind that any module may modify that value (any output filter may, too) up
>> until the AP_FTYPE_CONTENT_SET (runs after the AP_FTYPE_RESOURCE output
>> filters).
>> Additionally, please keep in mind that Firefox has begun the old I.E. hack
>> of sniffing the content and ignoring the Content-Type header if it can
>> figure it out, so you will have to be aware that content_type is not
>> indicative at any stage of what the browser is going to do.
>> Joe
>> --


View raw message