Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inconsistent MIME behavior

0 views
Skip to first unread message

Scot Hacker

unread,
Nov 11, 2004, 3:29:57 AM11/11/04
to
I'm seeing some very odd MIME handling from apache, hoping someone has an
idea as to what's going on. I have the usual MIME type for CSS defined in
conf/apache-mime.types as

text/css css

but some browsers (notably FireFox 1) are failing to load the stylesheet,
complaining that it has a MIME type of text/plain (yes, the MIME
declarations are also correct in the HTML).

Using http://web-sniffer.net/ and pointing it to
http://battellemedia.com/styles-site.css , I see that the MIME type of the
CSS file is reported as text/plain on one request, then as text/css on
another, as if apache is changing the MIME type at random.

I then added an explicit AddType to commonhttpd.conf:

AddType text/css .css

and restarted apache. The MIME type is still reported inconsistently. The
problem is the same for the main server and for vhosts. I'm baffled.
Suggestions?

Using:
Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/6.7.100mdk)
mod_ssl/2.0.48 OpenSSL/0.9.7c PHP/4.3.4 Server at battellemedia.com Port 80

Thanks,
Scot

HansH

unread,
Nov 11, 2004, 5:31:56 PM11/11/04
to
"Scot Hacker" <pub...@birdhouse.org> schreef in bericht
news:BDB86304.38772%pub...@birdhouse.org...

> I'm seeing some very odd MIME handling from apache, hoping someone has an
> idea as to what's going on. I have the usual MIME type for CSS defined in
> conf/apache-mime.types as
> text/css css
> but some browsers (notably FireFox 1)
Final release yesterday or the day before ...

> are failing to load the stylesheet,
> complaining that it has a MIME type of text/plain (yes, the MIME
> declarations are also correct in the HTML).
>
> Using http://web-sniffer.net/ and pointing it to
> http://battellemedia.com/styles-site.css , I see that the MIME type of the
> CSS file is reported as text/plain on one request, then as text/css on
> another, as if apache is changing the MIME type at random.

Or FoxPro is missing a clue at random ...
... BTW on what platform?

> I then added an explicit AddType to commonhttpd.conf:
> AddType text/css .css
> and restarted apache. The MIME type is still reported inconsistently. The
> problem is the same for the main server and for vhosts. I'm baffled.
> Suggestions?

Just thinking loud ...

Any chance PHP is parsing some and apache is serving others??

Does the response code alternate between 200 and 304 with respectively a
type of text/css and text/html ??


HansH


Scot Hacker

unread,
Nov 11, 2004, 7:31:27 PM11/11/04
to
On 11/11/04 2:31 PM, in article cn0p51$o19$1...@news.cistron.nl, "HansH"
<ha...@niet.op.het.net> wrote:

> Or FoxPro is missing a clue at random ...
> ... BTW on what platform?

The symptom is seen on both Win and Mac (probably others), but this is
really an apache MIME issue, not a browser issue, since the sniffer sees the
MIME types coming up differently on alternate requests (not truly
alternating - it's sort of random, but it's not hard to get the wrong
response if you try a few times).



>> I then added an explicit AddType to commonhttpd.conf:
>> AddType text/css .css
>> and restarted apache. The MIME type is still reported inconsistently. The
>> problem is the same for the main server and for vhosts. I'm baffled.
>> Suggestions?
> Just thinking loud ...
>
> Any chance PHP is parsing some and apache is serving others??

No, I don't have apache to set up to parse anything other than .php.

> Does the response code alternate between 200 and 304 with respectively a
> type of text/css and text/html ??

The response code is 200 regardless whether the MIME type is served up
properly or not.

To focus the problem, I just got around to testing an index.html file with
the sniffer and found that it alternates between types of text/plain and
text/html, just as css files alternate between text/plain and text/css.
Something is definitely fishy.

Thanks,
Scot


HansH

unread,
Nov 12, 2004, 1:30:01 PM11/12/04
to
"Scot Hacker" <pub...@birdhouse.org> schreef in bericht
news:BDB9445E.38821%pub...@birdhouse.org...

> On 11/11/04 2:31 PM, in article cn0p51$o19$1...@news.cistron.nl, "HansH"
> <ha...@niet.op.het.net> wrote:
> > Or FoxPro is missing a clue at random ...
> > ... BTW on what platform?
> The symptom is seen on both Win and Mac (probably others), but this is
> really an apache MIME issue, not a browser issue, since the sniffer sees
the
> MIME types coming up differently on alternate requests (not truly
> alternating - it's sort of random, but it's not hard to get the wrong
> response if you try a few times).
Reference to FP was made just because the latest was less than 48 h around.
BTW, the clients 'accept:' request header has some control over the
'content-type:' response header.

> >> I then added an explicit AddType to commonhttpd.conf:
> >> AddType text/css .css
> >> and restarted apache. The MIME type is still reported inconsistently.
The
> >> problem is the same for the main server and for vhosts. I'm baffled.
> >> Suggestions?

> > Any chance PHP is parsing some and apache is serving others??
> No, I don't have apache to set up to parse anything other than .php.

That is, everything -including this css- is _always_ served by or via php?

Any redirects involved?

> To focus the problem, I just got around to testing an index.html file
with
> the sniffer and found that it alternates between types of text/plain and
> text/html, just as css files alternate between text/plain and text/css.

Cannot reproduces the issue running multiple Debian servers with various
version of Apache 2.0.

> Something is definitely fishy.
Not in my pond ...

HansH


Scot Hacker

unread,
Nov 13, 2004, 1:13:14 AM11/13/04
to
On 11/12/04 10:30 AM, in article cn2vbf$5dt$1...@news.cistron.nl, "HansH"
<ha...@niet.op.het.net> wrote:


>>> Any chance PHP is parsing some and apache is serving others??
>> No, I don't have apache to set up to parse anything other than .php.
> That is, everything -including this css- is _always_ served by or via php?
>
> Any redirects involved?

No, but I've noticed by studying headers that the problem seems to come up
with cached requests, as if the apache cache isn't respecting MIME
preferences. I'm going to be working on that angle now.

> Cannot reproduces the issue running multiple Debian servers with various
> version of Apache 2.0.

Thanks for the report. It all helps.

Scot


HansH

unread,
Nov 13, 2004, 12:28:28 PM11/13/04
to
"Scot Hacker" <pub...@birdhouse.org> schreef in bericht
news:BDBAE5F9.38A2E%pub...@birdhouse.org...

> On 11/12/04 10:30 AM, in article cn2vbf$5dt$1...@news.cistron.nl, "HansH"
> <ha...@niet.op.het.net> wrote:
> >>> Any chance PHP is parsing some and apache is serving others??
> >> No, I don't have apache to set up to parse anything other than .php.
> > That is, everything -including this css- is _always_ served by or via
php?
> > Any redirects involved?
> No, but I've noticed by studying headers that the problem seems to come up
> with cached requests, as if the apache cache isn't respecting MIME
> preferences. I'm going to be working on that angle now.
How did you make Apache cache, reverse proxy by mod_proxy?

> > Cannot reproduces the issue running multiple Debian servers with various
> > version of Apache 2.0.

Neither cache nor proxy in use here.

HansH

Scot Hacker

unread,
Nov 14, 2004, 2:38:35 AM11/14/04
to
On 11/13/04 9:28 AM, in article cn5g41$u3g$1...@news.cistron.nl, "HansH"
<ha...@niet.op.het.net> wrote:

> How did you make Apache cache, reverse proxy by mod_proxy?

Well, here's where the plot thickens. As far as I know, I didn't turn
caching on at all.

#CacheNegotiatedDocs

Is commented out. Because I didn't explicitly enable it but
/var/cache/httpd is present and being filled with files, I thought that
caching was on by default. Apparently not. Where else should I look to to
see what's enabling it?

Thanks,
Scot

HansH

unread,
Nov 14, 2004, 6:24:16 AM11/14/04
to
"Scot Hacker" <pub...@birdhouse.org> schreef in bericht
news:BDBC4B79.38AB2%pub...@birdhouse.org...

> On 11/13/04 9:28 AM, in article cn5g41$u3g$1...@news.cistron.nl, "HansH"
> <ha...@niet.op.het.net> wrote:
> > How did you make Apache cache, reverse proxy by mod_proxy?
> Well, here's where the plot thickens. As far as I know, I didn't turn
> caching on at all.
> #CacheNegotiatedDocs
That does not make apache cache, it only make it send a more relaxed header
to caching proxies, allowing them to respond to a client a lesser than
optimal _negotiated_ match.

BTW, as you are running an apache2, why is there no ON or OFF?

> Is commented out. Because I didn't explicitly enable it but
> /var/cache/httpd is present and being filled with files, I thought that
> caching was on by default. Apparently not. Where else should I

> look to see what's enabling it?
Not knowing where to start either, my starting point would be
cd /etc/apache2/
grep -R cache *
to see what and where cache-ish directives are used.
And next
grep -R include *
to find any off tree includes to be checked too.

HansH


Scot Hacker

unread,
Nov 15, 2004, 4:13:59 AM11/15/04
to
On 11/14/04 3:24 AM, in article cn7f65$2ka$1...@news.cistron.nl, "HansH"
<ha...@niet.op.het.net> wrote:


>> #CacheNegotiatedDocs
> That does not make apache cache, it only make it send a more relaxed header
> to caching proxies, allowing them to respond to a client a lesser than
> optimal _negotiated_ match.
>
> BTW, as you are running an apache2, why is there no ON or OFF?

Interesting. I see that On|Off is mentioned in the docs for this directive,
but neither of my Mandrake 9.2 servers show it that way in the default
config. It's just as above.

>
>> Is commented out. Because I didn't explicitly enable it but
>> /var/cache/httpd is present and being filled with files, I thought that
>> caching was on by default. Apparently not. Where else should I
>> look to see what's enabling it?
> Not knowing where to start either, my starting point would be
> cd /etc/apache2/
> grep -R cache *
> to see what and where cache-ish directives are used.
> And next
> grep -R include *
> to find any off tree includes to be checked too.

Nothing interesting in either of those, unfortunately.

Thanks,
Scot


>
>
> HansH
>
>

0 new messages