elm*_*lmo 4 haproxy headers request
我设置了一个 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 无法读取请求标头。有没有办法解决?
小智 6
您可以使用 set-var
http-request set-var(txn.host) hdr(Host)
acl myhost var(txn.host) -m str example.com
http-response set-header X-Frame-Options SAMEORIGIN if myhost
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4102 次 |
最近记录: |