【问题标题】:KONG updating pluginsKONG 更新插件
【发布时间】:2021-10-05 09:48:39
【问题描述】:

我试图弄清楚如何使用 CURL 启用或禁用插件...我在文档中找到以下内容...所以我可以使用 CURL 创建插件...但我无法更新值,如何我要更新现有的插件吗

https://docs.konghq.com/hub/kong-inc/request-termination/


curl -X POST http://{HOST}:8001/plugins/ \

    --data "name=request-termination"  \

    --data "config.status_code=403" \

    --data "config.message=So long and thanks for all the fish!"


https://docs.konghq.com/gateway-oss/2.5.x/admin-api/


/services/{service name or id}/plugins/{plugin id}

当我尝试修补时,我得到 {"message":"not found"},这仅在我使用 /services/{服务名称或 id}/plugins/{plugin id} 时发生

如果我通过 plugins/plugin_id 它工作正常...

但理想情况下,我喜欢通过服务端点

【问题讨论】:

    标签: kong kong-plugin


    【解决方案1】:

    您是否注册了您的服务和路线? 例如

    curl -o /dev/null -s -H 'Content-Type: application/json' -X 'POST' http://localhost:8001/services -d '{"name":"peke.test.v1","url":"http://peke.was.here"}'
    curl -o /dev/null -s -H 'Content-Type: application/json' -X 'POST' http://localhost:8001/services/peke.test.v1/routes -d '{"paths":["/peke/oidc/v1"]}'
    
    

    之后,您可以为其添加插件:例如acl

    curl -o /dev/null -s -H 'Content-Type: application/json' -X 'POST' http://localhost:8001/services/peke.oidc.v1/plugins -d '{"name":"acl","enabled":true,"config":{"allow":["peke.oidc.v1"]}}'
    

    【讨论】:

      猜你喜欢
      • 2021-09-25
      • 2018-10-27
      • 2020-09-21
      • 2021-02-06
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-08
      相关资源
      最近更新 更多