小编elm*_*lmo的帖子

HAProxy - 根据请求主机添加响应头

我设置了一个 HAProxy 来将流量重定向到一些内部服务器。

我要做的是根据请求主机设置一些响应标头。不幸的是,我无法让它工作。

当前设置如下所示

acl mywebsite req.hdr(host) -i example.com

http-response set-header X-Frame-Options SAMEORIGIN if mywebsite
http-response set-header X-XSS-Protection 1;mode=block if mywebsite
http-response set-header X-Content-Type-Options nosniff if mywebsite
Run Code Online (Sandbox Code Playgroud)

据我了解,http-response set-header 无法读取请求标头。有没有办法解决?

haproxy headers request

4
推荐指数
1
解决办法
4102
查看次数

标签 统计

haproxy ×1

headers ×1

request ×1