Apache2 does not send "Content-Type" in the header

I have a standard Apache2 installation on Ubuntu.

I tried to get mod_deflate to work, which it does, but noticed that it was not gzipping my .js files. A closer inspection showed that apache was not sending Content-Type: for anything other than .php files . For them, it sends "text / html", which is strange since DefaultType is "text / plain".

I have no clue why this is ... mod_mime is on and I have not touched its configurations.

Here is an example of my server response to 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 
+4
source share
3 answers

It seems like this was the result of the item being cached using eTags, and I ignore this fact.

What was happening was that these items were in the browser cache and were not actually sent from the server, so there was no Content-Type. However, the browser received headers from the server, doing a cache search on eTag .. this is what I saw.

+4
source

This happens several times when the default Content-Type is commented out in httpd.conf.

In Ubuntu 8.04 it is set as text / html, as I recall.

+2
source

This is a known issue. What version of ubuntu?

I just tried installing ubuntu 8.10 and debian 5, where I did not touch 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 
0
source

All Articles