Apache2的不​​发送"的Content-Type"在头 [英] Apache2 not sending "Content-Type" in header

查看:388
本文介绍了Apache2的不​​发送"的Content-Type"在头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu标准Apache2的安装。

我试图让mod_deflate模块来工作,这确实如此,但发现它不是gzip压缩我的.js文件。仔细检查发现, Apache不发送内容类型:比.php文件其他任何东西。对于他们来说,这是送text / html的,这是奇怪的,因为缺省的类型是text / plain的。

我不知道这是为什么...... mod_mime启用了,我还没有触及CONFIGS吧。

下面是从我的服务器的示例响应的.css文件:

 日期星期三2009年4时48分12秒格林尼治标准​​时间3月11日
服务器的Apache / 2.2.9(Ubuntu的)
连接保持
保持活动超时= 15,上限= 96
Etag的30478-4fb-464bec553a600
有所不同的Accept-Encoding


解决方案

看起来这是使用ETag的,我俯瞰这个事实被缓存的项目的结果。

发生了什么事是,这这些项目都是在浏览器缓存,并没有真正被从服务器发送,这样就没有内容类型。但是,浏览器从服务器接收头,而这样做的ETAG缓​​存查找..这是我所看到的。

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

解决方案

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.

这篇关于Apache2的不​​发送"的Content-Type"在头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆