【问题标题】:Kong API is returning 404 after configuring a serviceKong API 在配置服务后返回 404
【发布时间】:2018-08-20 01:40:59
【问题描述】:

我使用 docker 设置了一个 Kong,它运行良好。我使用以下信息配置了本地服务;

{
    "host": "localhost",
    "created_at": 1534727577,
    "connect_timeout": 60000,
    "id": "cc3a858f-09fc-4baa-a206-3bd5ad3f514a",
    "protocol": "http",
    "name": "iwc_client_management",
    "read_timeout": 60000,
    "port": 9007,
    "path": "/rfg/iwconnect/1.0",
    "updated_at": 1534727577,
    "retries": 5,
    "write_timeout": 60000
}

我还使用以下信息为此服务创建了一条路线;

{
    "created_at": 1534727699,
    "strip_path": true,
    "hosts": [
        "iwconnect.com"
    ],
    "preserve_host": false,
    "regex_priority": 0,
    "updated_at": 1534727699,
    "paths": [
        "/clients"
    ],
    "service": {
        "id": "cc3a858f-09fc-4baa-a206-3bd5ad3f514a"
    },
    "methods": null,
    "protocols": [
        "http",
        "https"
    ],
    "id": "67c32503-e5d1-4aae-982b-bfa03a36582e"
}

根据这个例子,

Let's go through a few examples。考虑这样配置的路由:

{
    "hosts": ["iwconnect.com"],
    "paths": ["/clients],
    "methods": ["GET"]
}

根据 Kong 文件,以下调用将生效;

获取http://localhost:8000/clients 标题: 主机:iwconnect.com

但响应是:

error_404

{
    "message": "no route and no API found with those values"
}

我有什么遗漏或错误的配置吗?

感谢您的帮助。

【问题讨论】:

    标签: java spring kong


    【解决方案1】:

    我使用了与您相同的配置,并且 Kong 0.14 版在该配置下运行良好。我可以通过 /clients 请求获得呼叫结果。

    请检查 /usr/local/kong/logs/error.log 下的 kong 错误日志,看看您遇到了什么错误。如果缺少某些东西,错误也会让您知道。

    【讨论】:

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