【问题标题】:Getting started with KrakenD开始使用 KrakenD
【发布时间】:2021-11-11 08:11:27
【问题描述】:

我需要一些关于 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/"
                      ]
                  }
              ]
          }
      ]
    }

我错过了什么?

【问题讨论】:

    标签: kubernetes kraken.js krakend uber-kraken


    【解决方案1】:

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

    "backend": [
                      {
                          "url_pattern": "/hello",
                          "method": "GET",
                          "encoding": "string" ,
                          "host": [
                              "http://getting-started36-getting-going.apps.bamboutos.hostname.us/"
                          ]
                      }
                  ]
    

    【讨论】:

      猜你喜欢
      • 2022-11-14
      • 2022-08-16
      • 1970-01-01
      • 2022-11-04
      • 2020-03-18
      • 2016-09-04
      • 2015-02-05
      • 2010-11-03
      • 2010-09-11
      相关资源
      最近更新 更多