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

How do I "override" Server response header on a ReverseProxied website?

· 52CE 我爱测

I am running a couple of websites on different server on a local network. All websites are Proxied via one server where HTTPS is added and the trafic is monitored. Currently, if someone makes a: curl -I subdomain.domain.tld The r…

问题原文

原帖链接 · Orphans · CC BY-SA 3.0

I am running a couple of websites on different server on a local network. All websites are Proxied via one server where HTTPS is added and the trafic is monitored.

Currently, if someone makes a:

curl -I subdomain.domain.tld

The result is:

curl -I https://subdomain.domain.tld
HTTP/1.1 200 OK
Date: Fri, 13 Jan 2017 09:19:02 GMT
Server: Jetty(8.y.z-SNAPSHOT)
Content-Type: text/html
Content-Length: 2379
Last-Modified: Tue, 10 Jan 2017 11:15:29 GMT

How can I "override" the response the server behind the proxy gives with another respons from the ReverseProxy?

For example, I want my output to look something like this (if possible)

curl -I https://dubdomain.domain.tld
HTTP/1.1 200 OK
Date: Fri, 13 Jan 2017 09:19:02 GMT
Server: Apache24 (or even something else)
Content-Type: text/html
Content-Length: 2379
Last-Modified: Tue, 10 Jan 2017 11:15:29 GMT

Is this achievable?

已采纳解答

原帖链接 · Daniel Ferradal · CC BY-SA 3.0

You can not remove the Server Header in Apache, but in your case, yes you can just show the server tokens of the reverse proxy by adding:

Header unset Server

What this will do is remove the server header returned by the "backend" and show you the one from the reverse proxy.

If by any chance you want to remove or change this header even from the response of the reverse proxy, you will have to use mod_security, or at least that's the only method I know.

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

资料来源与适用范围

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

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

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