It is really helpful to get right information. Thanks for the prompt reply.
So, route matching is not implemented in any of plugins? route matching happens before any plugin is executed?
My use case is, add some custom logic, right after the route is matched.
Is there any suggestion to utilize existing route matching functionality from kong and add some additional custom stuff once route is matched? https://docs.konghq.com/1.0.x/pdk/kong.router/ ?
https://docs.konghq.com/2.0.x/pdk/kong.router/ This will give current matched route. Thus route matching can be mimicked in custom plugin by using this. Once matching route is found, any additional operations can be performed. No need to maintain the plugin execution order.
Use-case: Get matched route and perform some operations on matched route.
I was thinking of two approaches.
Override native plugin of route matching and add additional functionality apart from native logic.
Now, route matching functionality is performed in the core logic and not in plugins. So, this won’t work.
Introduce a custom plugin, somehow retrieve the matched route, perform additional functionality.
You don’t need to hook into router for that purpose.
The router is used for changing the route that was matched.
In your case, you need to define a route and attach a plugin to that route. The plugin will be executed only when there is a request that matches the route you had defined.
I use “kong.response.exit(res.status, res.body)”
when res.status=200，The interface is open ，no problem
but when res.status!=200,have questions
questions is No ‘Access-Control-Allow-Origin’ header is present on the requested resource.