Reputation:
I have a standard Apache2 installation on Ubuntu.
I was trying to get mod_deflate to work, which it does, but noticed it was not gzipping my .js files. A closer inspection revealed that apache isn't sending Content-Type: for anything other than .php files. For them it's sending "text/html," which is strange since DefaultType is "text/plain."
I have no clue why this is... mod_mime is enabled and I haven't touched the configs for it.
Here's an example response from my server for a .css file:
Date Wed, 11 Mar 2009 04:48:12 GMT
Server Apache/2.2.9 (Ubuntu)
Connection Keep-Alive
Keep-Alive timeout=15, max=96
Etag "30478-4fb-464bec553a600"
Vary Accept-Encoding
Upvotes: 7
Views: 10513
Reputation: 38106
It's a known problem. Which ubuntu version is it?
I just tried on ubuntu 8.10 and debian 5 installations where I havent touched the apache configuration. Both work fine:
HTTP/1.x 200 OK
Date: Wed, 11 Mar 2009 10:25:17 GMT
Server: Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4 with Suhosin-Patch mod_wsgi/2.3 Python/2.5.2
Last-Modified: Wed, 11 Mar 2009 10:19:41 GMT
Etag: "1544ae-12-464d534a6c940"
Accept-Ranges: bytes
Content-Length: 18
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/css
Upvotes: 0
Reputation:
It looks like this was a result of the item being cached using eTags, and my overlooking that fact.
What was happening was that this these items were in the browser cache, and were not actually being sent from the server, thus there was no Content-Type. However, the browser was receiving headers from the server while doing the cache lookup on the eTag.. this is what I was seeing.
Upvotes: 5
Reputation: 121
This happen some times when Content-Type default value is commented in httpd.conf.
In Ubuntu 8.04 it is set to text/html as I remember.
Upvotes: 2