apache / apisix-go-plugin-runner

Go Plugin Runner for APISIX
https://apisix.apache.org/
Apache License 2.0
167 stars 69 forks source link

request help: configure the plugin through dashboard does not work #71

Closed jiangfucheng closed 2 years ago

jiangfucheng commented 2 years ago

Issue description

I want test apisix-go-plugin-runner whether can be used, it can be intercept by plugin when i used admin API create the Router, but it's not work when i create the Router by dashboard.

adminAPI request used apisix-go-plugin-runner docs example

curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
  "uri": "/get",
  "plugins": {
    "ext-plugin-pre-req": {
      "conf": [
        { "name": "say", "value":"{\"body\":\"hello\"}"}
      ]
    }
  },
  "upstream": {
        "type": "roundrobin",
        "nodes": {
            "127.0.0.1:1980": 1
        }
    }
}
'

The following is used for the configuration of the dashboard

{
  "uri": "/*",
  "name": "nginx-test",
  "desc": "nginx-test",
  "methods": [
    "GET",
    "POST",
    "PUT",
    "DELETE",
    "PATCH",
    "HEAD",
    "OPTIONS",
    "CONNECT",
    "TRACE"
  ],
  "plugins": {
    "ext-plugin-pre-req": {
      "disable": true,
      "name": "say",
      "value": "{\"body\":\"hello\"}"
    }
  },
  "upstream_id": "398094286752580298",
  "status": 1
}

upstream configuration

{
  "nodes": [
    {
      "host": "10.60.104.20",
      "port": 9081,
      "weight": 1
    },
    {
      "host": "10.60.104.20",
      "port": 9082,
      "weight": 1
    }
  ],
  "timeout": {
    "connect": 6,
    "send": 6,
    "read": 6
  },
  "type": "roundrobin",
  "scheme": "http",
  "pass_host": "pass",
  "name": "nginx-test",
  "desc": "nginx-test",
  "keepalive_pool": {
    "idle_timeout": 60,
    "requests": 1000,
    "size": 320
  }
}

Environment

jiangfucheng commented 2 years ago

I redeployed apisix by docker-compose, it's working.