【问题标题】:Krakend endpoint variable within extra config额外配置中的 Krakend 端点变量
【发布时间】:2022-12-14 17:17:07
【问题描述】:

我必须在额外配置代理平面图过滤器参数中使用端点变量。

...
{
  "endpoint": "/cascade/{entity}/{id}/{subentity}/{commonField}",
  "backend": [
    {
      "url_pattern": "/api/{entity}/{id}",
      "host": ["http://myapi:8080/"],
      "encoding": "json",
      "extra_config": {
        "proxy": {
          "flatmap_filter": [
            {
              "type": "move",
              "args": ["{{commonField}}","customField"]
            }
          ]
        }
      }
    }
  ]
}
...

我需要从 url 获取共同领域并在 flatmap 过滤器中使用它作为 args 数组的第一个值。 但这不起作用。是一种我不能在配置中使用 URL 变量的配置约束吗?

【问题讨论】:

    标签: url proxy krakend


    【解决方案1】:

    虽然目前无法在 flatmap_filter 中使用 url_pattern 中的变量,但您始终可以使用 Lua scripting 或 request/response modifier plugin(使用 Golang)来实现该转换。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多