【问题标题】:Trying to use set-var in haproxy config to set to a string尝试在 haproxy 配置中使用 set-var 设置为字符串
【发布时间】:2022-01-14 11:27:47
【问题描述】:

我想在 haproxy 的前端块中设置一个变量,以便它可以在后端块中使用。

我有:

   http-request set-var(txn.backend) "host.azurewebsites.net",lower if { path -m str /xc }

但 haproxy 无法解析此内容并出现以下错误:

[ALERT]    (1) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:35] : error detected in frontend 'http' while parsing 'http-request set-var(txn.backend)' rule : unknown fetch method 'host.azurewebsites.net'.

这似乎是一件非常简单的事情,但我不知所措!

【问题讨论】:

    标签: haproxy


    【解决方案1】:

    回答我自己的问题,在文档中找到它:https://www.haproxy.com/documentation/hapee/latest/onepage/#7.3.2-str

    所以:

    http-request set-var(txn.backend) str("host.azurewebsites.net"),lower if { path -m str /xc }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-25
      • 1970-01-01
      • 2016-05-07
      • 1970-01-01
      • 1970-01-01
      • 2016-09-01
      • 2012-05-19
      • 2020-09-20
      相关资源
      最近更新 更多