I think neither priority nor order can give users an intuitive understanding of the execution order of plugins, because of the concept of nginx phase.
For developers, we need to list a table in the document to publicize the execution order after the combination of the priority of the plug-in and the plug-in phase , so that it is convenient for developers and team review. For users, we need to use some API feedback to inform users of the execution order of plugins bound to a route, or how many routes a plugin is bound to. Chao Zhang <[email protected]> 于2021年2月27日周六 下午12:18写道: > Currently the plugin is embedded as an object inside route, we may also > support the array type. When the plugin is object, just use the priority > way; when it’s an array, running them from top to bottom (it’s not > absolutely right since the concept of phase). > > Also, mention the changes in FAQs and Docs, what’s more, the dashboard UI > needs some friendly prompts to mention the order. > > Ming Wen <[email protected]>于2021年2月27日 周六11:50写道: > > > hello, dev, > > > > Now each plug-in of Apache APISIX has a priority attribute. If multiple > > plug-ins are configured on an API, in a certain phase (rewrite/log and > > other nginx phases), these will be executed in the order of priorities. > > > > This design brings two problems: > > 1. Developers always need to set priority when adding new plug-ins, > > otherwise it will conflict with existing plug-ins. > > 2. When multiple plug-ins are set, it is difficult to distinguish the > order > > in which these plug-ins are executed, which brings some troubles to > > debugging. It is impossible for developers to remember the priority > > attributes of all plugins. > > > > So, can we not use the priority, but the configuration order of the > > plug-ins (the earliest execution at the top of the plug-in list) to > execute > > sequentially? > > > > In this way, developers will no longer have any doubts about the run > order. > > > > Of course, there is no perfect technical solution, it will also bring a > > problem: > > if the developer configures the wrong order, it will bring some risks. > For > > example, a developer want to run kafka plugin for send log first, then > run > > request rewrite plugin to change http header. This is impossible. > > > > However, this risk is controllable, and we can add two judgments: > > 1. Make stage judgments in the Admin API, for example, it is not allowed > to > > execute plug-ins in the rewrite stage after the plug-ins in the log > stage; > > 2. Make obvious interactive prompts and tests on the dashboard. > > > > What do you think? > > > > Thanks, > > Ming Wen, Apache APISIX PMC Chair > > Twitter: _WenMing > > >
