如何在kong中为API配置ssl

Luk*_*uke 6 ssl kong

我正在开发 kong 0.13.1。按照文档,我添加了证书,如下所示:

{
    "data": [
        {
            "cert": "certificate is really here", 
            "created_at": 1529667116000, 
            "id": "6ae77f49-a13f-45b1-a370-8d53b35d7bfd", 
            "key": "The key is really here", 
            "snis": [
                "myapp.local", 
                "mockbin.myapp.local"
            ]
        }
    ], 
    "total": 1
}
Run Code Online (Sandbox Code Playgroud)

然后添加了一个与 http 完美配合的 API:

{
    "data": [
        {
            "created_at": 1529590900803, 
            "hosts": [
                "mockbin.myapp.local"
            ], 
            "http_if_terminated": false, 
            "https_only": false, 
            "id": "216c23c5-a1ae-4bef-870b-9c278113f8f8", 
            "name": "mockbin", 
            "preserve_host": false, 
            "retries": 5, 
            "strip_uri": true, 
            "upstream_connect_timeout": 60000, 
            "upstream_read_timeout": 60000, 
            "upstream_send_timeout": 60000, 
            "upstream_url": "http://localhost:3000"
        }
    ], 
    "total": 1
}
Run Code Online (Sandbox Code Playgroud)

但不幸的是,Kong 不断向我发送位于 /usr/local/kong/ssl/kong-default.crt

我正在测试它:

openssl s_client -connect localhost:8443/products -host mockbin.myapp.local -debug
Run Code Online (Sandbox Code Playgroud)

过去有一个动态 ssl 插件(其中 api ssl 是在 0.3.0 版中添加的),但自 0.10 更新后它就消失了。

我知道这有点解决我的代码配置问题,但可能其他人也可能遇到类似的问题。

Luk*_*uke 1

我花了一些时间来解决它,但没能解决它。正如kong 文档所说,api 已被弃用,因此我最终将所有内容重写为路由和服务,我建议您也这样做。根据文档逐步实施时,路由和服务工作得非常好。