Virtual servers not serving .css files properly, issuing 302 response and forwarding to 404 error page

apache-2.2cssmime-typevirtualhost

I've got 3 virtualhost directives, and they each host .php and .html files without any problem. However, 2 of them don't seem to be serving .css files correctly. When I check the header response I get this message:

HTTP/1.1 302 Found 
Date: Mon, 11 Apr 2011 14:42:05 GMT 
Server: Apache/2.2.3 (CentOS) 
Location: http://www.domain.com/index.php/results/404 
Connection: close 
Content-Type: text/html; charset=iso-8859-1

The responce that I get from the server that is serving them correctly looks like this:

HTTP/1.1 200 OK 
Date: Mon, 11 Apr 2011 15:37:19 GMT 
Server: Apache/2.2.3 (CentOS) 
Last-Modified: Mon, 11 Apr 2011 14:49:52 GMT 
ETag: "af002a-76d2-b0236400" 
Accept-Ranges: bytes 
Content-Length: 30418 
Connection: close 
Content-Type: text/css

I'm thinking that the mime.types file must be configured correctly, because there is one virtual server working correctly.

Any ideas on what I could be doing wrong?

Best Answer

Seems like either your web-application and/or your web-server are mis-configured. Unfortunately, you will need to trace where the problem is. If these 3 servers are meant for load-balancing, make sure that the configurations are exactly the same.

If you configured each of them individually, you might be surprised that there is just something really small missing on the other machines. Same goes with your application itself.

Try replicating the existing configuration from your working server to those not working. The easiest way to do this would either be through something like rsync of the files or dd of the disk image.

UPDATE

In that case, you need to check your application configuration. From the errors, it looks like the application is the one sending the 302 to a 404 page. Try sticking a non-css file into the same directory as the CSS and retrieve it using the same URL as the css. Sometimes, some of these CMS systems intercept the request and do their own thing with the path-info.