大网数据广告活动
服务器运维问答

Why are http headers not set when I use proxypass on apache2.2

· 52CE 我爱测

I have an apache2.2 server with mod_proxy and mod_headers installed. On a request running with a ProxyPass directive, none of the Header set directives work, ie the header's aren't set in the response. However if I remove the Pro…

问题原文

原帖链接 · Glenn Slaven · CC BY-SA 3.0

I have an apache2.2 server with mod_proxy and mod_headers installed. On a request running with a ProxyPass directive, none of the Header set directives work, ie the header's aren't set in the response.

However if I remove the ProxyPass directive the headers are set. Is there some configuration that disables setting headers when using mod_proxy?

已采纳解答

原帖链接 · aglassman · CC BY-SA 4.0

Despite the Apache mod_headers doc saying that it does not matter where the Header line goes, it apparently does. The only way I could get the header added was to put it in the same location scope as the proxy pass.

I initially had the proxy pass defined in the VirtualHost tag directly, but had to move it into the LocationMatch sub tag.

<LocationMatch "/myapp">
    ProxyPass http://1.1.1.1:8080/myapp disablereuse=On
    ProxyPassReverse http://1.1.1.1:8080/myapp
    Header add X-UA-Compatible "IE=7"
</LocationMatch>

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-07-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。