304响应不设置自定义页眉与mod_headers中的Apache [英] 304 response does not set custom header for apache with mod_headers

查看:521
本文介绍了304响应不设置自定义页眉与mod_headers中的Apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<VirtualHost *:80>
    ServerAdmin webmaster@dev.dom.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
    ServerName dev.dom.com
    ServerAlias dev.dom.com
    ErrorLog "logs/dev.dom.com-error.log"
    CustomLog "logs/dev.dom.com-access.log" common
    PassEnv CLUSTER
    Header always set X-Cluster "%{CLUSTER}e"
</VirtualHost>

下面是我的配置。我有一个环境变量,它告诉我,我是什么群集上,这是在X-集群的标题传递。这将返回罚款200或404的响应,但304未修改响应永远不会返回头,虽然它返回其他相应的Apache头。

Here is my configuration. I have an environment variable which tells me what cluster I am on, which is passed as a header in 'X-Cluster'. This returns fine on a 200 or a 404 response, but a 304 Not Modified response never returns the header, even though it returns other appropriate Apache headers.

我如何获得的头一个304响应期间设置?

How do I get the header to be set during a 304 response?

推荐答案

阿帕奇明确禁止修改响应头为符合HTTP规范一个304响应。这种类型的响应的名称为未改性。您可以使用Apache的滤波器结构,修改此行为通过编写自定义的模块,或者与可能的mod_perl,但它是最有可能的错误的做法。

Apache explicitly prohibits modifying the response headers in a 304 response for compliance with the http spec. The name of this type of response is "Not modified". You can modify this behavior using Apache's filter architecture, by writing a custom module, or with mod_perl perhaps, but it's most likely the wrong thing to do.

这篇关于304响应不设置自定义页眉与mod_headers中的Apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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