是否可以覆盖“服务器名称"?traefik 中的响应头? [英] Is it possible to overwrite "server name" response header in traefik?

查看:60
本文介绍了是否可以覆盖“服务器名称"?traefik 中的响应头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Traefik(版本 1.7.10)设置一个新服务器,用于负载平衡不同的 NGINX 和 PHP-FPM 容器.

I'm setting up a new server with Traefik (version 1.7.10) for load balancing different NGINX and PHP-FPM containers.

目前访问者在响应头中看到我的容器使用 NGINX.对于所有容器,我在哪里可以将服务器响应标头覆盖为其他内容(例如FunnyServer")?

Currently visitors see in the response header that my containers using NGINX. Where can I globaly, for all containers, overwrite the server response header to something other (like "FunnyServer") ?

我过去曾用 HAProxy 做过这件事,想知道如何用 Traefik 做到这一点?

With HAProxy I have done this in the past and wondering how to do this with Traefik?

在这里您可以看到来自 HAProxy 的响应:

Here you see the response coming from HAProxy:

cache-control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0
content-type: text/html; charset=utf-8
date: Wed, 17 Apr 2019 20:20:15 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
pragma: no-cache
server: MonkeysBananaServer    <===== WITH HAPROXY!!! Traefik??? 
set-cookie: PHPSESSID=1234567890abcdef; path=/; domain=.xxx.xx
status: 200
x-powered-by: PHP/x.x.x

如您所见,在 HAProxy 下,我已将响应标头设置为MonkeysBananaServer".

As you can see, under HAProxy I have set the response header to "MonkeysBananaServer".

推荐答案

您可以覆盖响应头:

traefik.frontend.headers.customResponseHeaders=server:FunnyServer

https://docs.traefik.io/configuration/backends/码头工人/#custom-headers

这篇关于是否可以覆盖“服务器名称"?traefik 中的响应头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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