在PHP/Apache2中删除我的头是什么?
我使用PHP5.3和Apache 2.0提供一个脚本,该脚本向输出中添加了许多头文件:在PHP/Apache2中删除我的头是什么?,php,apache,http,Php,Apache,Http,我使用PHP5.3和Apache 2.0提供一个脚本,该脚本向输出中添加了许多头文件: header('HTTP/1.1 200 OK'); header("Content-Type: application/json"); header("Last-Modified: $lastmode"); // $lastmod = Tue, 01 Mar 2011 14:56:22 +0000 header("Etag: $etag"); // Etag = 5da02274fcad09a55f4d7
header('HTTP/1.1 200 OK');
header("Content-Type: application/json");
header("Last-Modified: $lastmode"); // $lastmod = Tue, 01 Mar 2011 14:56:22 +0000
header("Etag: $etag"); // Etag = 5da02274fcad09a55f4d74467f66a864
现在,除了上次修改的和Etag
之外,所有的标题都通过了。在我的httpd.conf中,我有以下内容:
Header unset Cache-Control
Header unset Pragma
但我的回答是:
HTTP/1.1 200 OK
Date: Tue, 01 Mar 2011 16:49:10 GMT
Server: Apache/2.2.14 (EL) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5
Keep-Alive: timeout=15, max=8000
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json
Expires: 0
Cache-Control: no-cache
我的上次修改的
和Etag
标题不见了,我们有缓存控制
和过期
我还应该提到,我已经禁用了mod_expires
,但没有任何效果。我在这一点上拔出我的头发,因为无论我做什么,标题根本不存在。什么可能导致它们被移除
谢谢,
J
更新:似乎Apache在PHP关闭后添加了额外的头,我认为它也在删除我上面设置的头。在PHP中注册关机函数并调用apache\u response\u headers
显示:
Pragma=
Expires=
Etag=5da02274fcad09a55f4d74467f66a864
Last-Modified=Tue, 01 Mar 2011 14:56:22 +0000
Keep-Alive=timeout=15, max=8000
Connection=Keep-Alive
Transfer-Encoding=chunked
Content-Type=application/json
为了回答我自己的问题,我用来调试的工具似乎让我感到悲伤。首先是mod_expires模块导致了问题,但是删除它没有效果的原因是我用来调试问题的代理(Charles)似乎修改了头。一旦查尔斯被带出循环,我的头球就在那里 什么值是$lastmode
和$etag
?对不起,我已经更新了问题以显示值。