0

我需要一些对 KrakenD 的初学者帮助。我在 Ubuntu 上运行它。下面提供了配置。

我能够毫无问题地访问 /healthz API。

我的挑战是 /hello 路径返回错误 500。我希望此路径重定向到在http://getting-started36-getting-going.apps.bamboutos.hostname.us/上运行的 Quarkus 应用程序。

为什么这不起作用?如果我修改 /hello 后端并使用假主机,我会得到完全相同的结果。这表明 KrakendD 甚至没有尝试连接到后端。

在日志中,KrakendD 说:

Error #01: invalid character 'H' looking for beginning of value

海妖.json:

{
      "version": 2,
      "port": 9080,
      "extra_config": {
          "github_com/devopsfaith/krakend-gologging": {
              "level": "DEBUG",
              "prefix": "[KRAKEND]",
              "syslog": false,
              "stdout": true,
              "format": "default"
          }
      },
      "timeout": "3000ms",
      "cache_ttl": "300s",
      "output_encoding": "json",
      "name": "KrakenD API Gateway Service",
      "endpoints": [
          {
              "endpoint": "/healthz",
              "extra_config": {
                  "github.com/devopsfaith/krakend/proxy": {
                      "static": {
                          "data": {       "status": "OK"},
                          "strategy": "always"
                      }
                  }
              },
              "backend": [
                  {
                      "url_pattern": "/",
                      "host": ["http://fake-backend"]
                  }
              ]
          },
          {
              "endpoint": "/hello",
              "extra_config": {},
              "backend": [
                  {
                      "url_pattern": "/hello",
                      "method": "GET",
                      "host": [
                          "http://getting-started36-getting-going.apps.bamboutos.hostname.us/"
                      ]
                  }
              ]
          }
      ]
    }

我错过了什么?

4

1 回答 1

1

将 "encoding": "string" 添加到后端部分。

"backend": [
                  {
                      "url_pattern": "/hello",
                      "method": "GET",
                      "encoding": "string" ,
                      "host": [
                          "http://getting-started36-getting-going.apps.bamboutos.hostname.us/"
                      ]
                  }
              ]
于 2021-09-16T12:41:55.560 回答