发送304时的Apache忽略PHP头 [英] Apache ignoring PHP headers when sending a 304
问题描述
在我的Apache + mod_php5设置自定义标题,这工作得很好:
When I set a custom header in Apache + mod_php5, this works fine:
header('Foo: Bar');
但是,当我尝试这个的,而的同时送一个304未修改响应,头部似乎被Apache删除(一起通过X供电,通过和其他标准的头)。
But when I try this while also sending a 304 Not Modified response, the header appears to be removed by apache (along with X-Powered-By and other standard headers).
header('HTTP/1.1 304 No Content');
header('Foo: Bar');
有谁知道如何解决这个问题呢?
Does anyone know how to solve this issue?
推荐答案
这难道不是回答这个问题?
Does this not answer the question?
如果有条件的习惯强大的缓存验证(见13.3.3),响应不应该包含其他实体头。否则(即,有条件的习惯弱验证),响应必须不包括其他实体头;缓存的实体机构和更新头之间的prevents不一致。
If the conditional GET used a strong cache validator (see section 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers.
http://www.w3.org/Protocols /rfc2616/rfc2616-sec10.html#sec10.3.5
这篇关于发送304时的Apache忽略PHP头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!