【问题标题】:HAProxy http-request with DATAPLANE API带有 DATAPLANE API 的 HAProxy http-request
【发布时间】:2021-01-18 16:07:25
【问题描述】:

我正在摆弄 dataplaneapi,这是一个很好的补充。 但是,我无法在我的前端找到适当的参数来操作 http 请求。规则需要如下所示:

http-request replace-header Host .* 1595708099.pages.domain.de if ACL_somename_de

我当前的请求转到 http_request_rules 端点:/services/haproxy/configuration/http_request_rules 请求正文如下所示:

{ "cond": "if", "cond_test": "ACL_somename_de", "hdr_name": "Host", "index": 0, "type": "replace-header" }

输出是:

http-request replace-header Host if ACL_somename_de

但是我仍然缺少正则表达式条件部分。在常规的 HAproxy 文档上,它被称为和 看: https://www.haproxy.com/documentation/aloha/12-5/traffic-management/lb-layer7/http-rewrite/

我在 dataplane 文档中找不到这些值。 https://www.haproxy.com/documentation/dataplaneapi/latest/#operation/createHTTPRequestRule

这甚至可能吗?如果可以,如何?

【问题讨论】:

    标签: httprequest haproxy api-gateway


    【解决方案1】:

    我在 github 上询问了人们,他们给出了答案:

    curl --request POST \ --url 'http://127.0.0.1:5679/v2/services/haproxy/configuration/http_request_rules?parent_name=test_2&parent_type=frontend&version=61' \ --header 'Authorization: Basic YWRtaW46YWRtaW4=' \ --header 'Content-Type: application/json' \ --data '{ "cond": "if", "cond_test": "ACL_somename_de", "index": 0, "type": "replace-header", "hdr_format": "1595708099.pages.domain.de", "hdr_match": ".*", "hdr_name": "Host" }'

    来源: https://github.com/haproxytech/dataplaneapi/issues/149

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-19
      • 1970-01-01
      • 1970-01-01
      • 2016-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      相关资源
      最近更新 更多