As per the current order of execution for the bundled plugins, first ACL and then the request-transformer plugin will be executed if both of them I am adding to a service.
For a service I need to customize the plugin execution, I need to execute request-transformer plugin first and then ACL.
How can I achieve it?
The order in which the plugins are executed depends on each plugins’ PRIORITY field, set up on its handler.lua file.
A possible solution would be creating a custom plugin: it would be a copy of
request-transformer (named something else, like
request-transformer-high-priority) which is exactly the same as
request-transformer but with a priority higher than 950. Then use that modified plugin instead of the default
You might want to look at our Plugin Development Guide’s Install Section for details about how to install a custom plugin.
I have created a custom plugin same as request-transformer plugin.
local BasePlugin = require “kong.plugins.base_plugin”
local access = require “kong.plugins.kong-custom-plugin.access”
local CustomPluginHandler = BasePlugin:extend()
CustomPluginHandler.PRIORITY = 952
CustomPluginHandler.VERSION = “1.0.0”
And I am using the same schema.lua and access.lua files of request-transformer.
The custom plugin created successfully and also I am able to add to a service. However, when I am trying to update the plugin all the plugin fields are displayed. I am only able to see api_id, service_id, route_id and consumer_id.
I should be able to view all the field similar to request-transformer.
What changes required, am I not reading the access.lua properly?
Output of adding plugin:
/etc/kong # curl -i -X POST --url http://localhost:8001/services/example-service/plugins/ --data name=kong-custom-plugin
HTTP/1.1 201 Created
Date: Thu, 28 Mar 2019 14:33:36 GMT
Content-Type: application/json; charset=utf-8
Note : config is blank