Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order in which Plugins are executed #267

Closed
shashiranjan84 opened this issue May 27, 2015 · 14 comments
Closed

Order in which Plugins are executed #267

shashiranjan84 opened this issue May 27, 2015 · 14 comments
Labels
task/feature Requests for new features in Kong

Comments

@shashiranjan84
Copy link
Contributor

We need a better way than having a PRIORITY constant in a plugin's handler to decide the order of execution of the plugins. As the number of plugins grow, it's not intuitive.

More appropriate would be putting the order in the configuration.

@subnetmarco
Copy link
Member

I agree. As the number of plugins grows it's hard to define what PRIORITY each plugin should have.

Having the order in the configuration is an option: plugins will be executed accordingly to their order in the available_plugins property in the configuration. But it's not bulletproof, because I am pretty sure users will add plugins to the array pretty randomly.

Another option would be to sit down and look at the use cases that we have, and introduce some triggers in the lifecycle of the request, like:

  • access.before_authentication
  • access.on_request_preconditions
  • access.before_proxy

Etc

@subnetmarco subnetmarco added idea/new plugin [legacy] those issues belong to Kong Nation, since GitHub issues are reserved for bug reports. minor labels May 29, 2015
@thibaultcha thibaultcha added [about] plugins and removed idea/new plugin [legacy] those issues belong to Kong Nation, since GitHub issues are reserved for bug reports. labels Oct 15, 2015
@thibaultcha thibaultcha added the task/feature Requests for new features in Kong label Oct 26, 2015
@thibaultcha
Copy link
Member

Another link to #505 when redesigning the Model.

@jdarling
Copy link

jdarling commented Jun 2, 2017

Hopefully this is still up for debate, but it seems to me that having some type of endpoints like /order/plugins and /order/apis/plugins or similar that returned and accepted an ordered list of plugins provides the best flexibility. This would allow the user to control the flow through plugins, and by default could be autosorted on the PRIORITY.

@ernsheong
Copy link

ernsheong commented Aug 31, 2017

As it currently stands, what is the plugin order? Undefined?

Edit: Sorry, here it is https://getkong.org/docs/0.11.x/plugin-development/custom-logic/

I'd say maybe a custom priority field for each plugin to override current the PRIORITY field would suffice, and an API retrieve the plugins in priority order might make sense.

@macedogm
Copy link

macedogm commented Aug 31, 2017 via email

@philbarr
Copy link

Any more news on this issue? Being able to set priority order when applying the plugin would be great.
I would really like to be able to do something like this:

curl -X POST http://kong:8001/services/myservice/plugins \
    --data "name=myplugin" \
    --data "priority=1000"

As it stands the only way to change priority is to fork the plugin and change it manually (as far as I am aware anyway).

@samwonwyd
Copy link

If two plugins's phases and priority are same, which one will be executed first?

@thibaultcha
Copy link
Member

thibaultcha commented Jan 15, 2019

@samwonwyd In this case the order is (was) undefined.

@bungle
Copy link
Member

bungle commented Aug 15, 2019

@samwonwyd it is not undefined, it is sorted by plugin created_at.

bungle added a commit that referenced this issue Oct 15, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
bungle added a commit that referenced this issue Oct 15, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
bungle added a commit that referenced this issue Oct 16, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
bungle added a commit that referenced this issue Oct 16, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
hishamhm pushed a commit that referenced this issue Oct 18, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
dndx pushed a commit that referenced this issue Nov 1, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
locao pushed a commit that referenced this issue Nov 5, 2019
- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

- pl.compat now provides unpack as table.unpack on Lua 5.1

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
hutchic pushed a commit that referenced this issue Nov 21, 2019
#### 1.7.0 (2019-10-14)

##### New features

- utils.quote_arg will now optionally take an array of arguments and escape them all into a single string.
- app.parse_args now accepts a 3rd parameter with a list of valid flags and aliases
- app.script_name returns the name of the current script (previously a private function)

##### Changes

- Documentation updates
- utils.quit: exit message is no longer required, and closes the Lua state (on 5.2+).
- utils.assert_arg and utils.assert_string: now return the validated value
- pl.compat: now exports the jit and jit52 flags
- pretty.write: now sorts the output for easier diffs #293

##### Fixes

- utils.raise changed the global on_error-level when passing in bad arguments
- utils.writefile now checks and returns errors when writing
- compat.execute now handles the Windows exitcode -1 properly
- types.is_empty would return true on spaces always, indepedent of the parameter
- types.to_bool will now compare case-insensitive for the extra passed strings
- app.require_here will now properly handle an absolute base path
- stringx.split will no longer append an empty match if the number of requested elements has already been reached #295
- path.common_prefix and path.relpath return the result in the original casing (only impacted Windows) #297
- dir.copyfile, dir.movefile, and dir.makepath create the new file/path with the requested casing, and no longer force lowercase (only impacted Windows) #297
- added a missing assertion on path.getmtime #291
- stringx.rpartition returned bad results on a not-found #299

#### 1.6.0 (2018-11-23)

##### New features

- pl.compat now provides unpack as table.unpack on Lua 5.1

##### Changes

- utils.unpack is now documented and respects .n field of its argument.
- tablex.deepcopy and tablex.deepcompare are now cycle aware (#262)
- Installing through LuaRocks will now include the full rendered documentation

##### Fixes

- Fixed seq.last returning nil instead of an empty list when given an empty iterator (#253).
- pl.template now applies tostring when substituting values in templates, avoiding errors when they are not strings or numbers (#256).
- Fixed pl.import_into not importing some Penlight modules (#268).
- Fixed version number stuck at 1.5.2 (#260).
- Fixed types.is_empty returning true on tables containing false key (#267).
- Fixed test.assertraise throwing an error when passed an array with a function to call plus its arguments (#272).
- Fixed test.assertraise not throwing an error when given function does not error but instead returns a string matching given error pattern.
- Fixed placeholder expressions being evaluated with wrong precedence of binary and unary negation.
- Fixed placeholder expressions being evaluated assuming wrong binary operator associativity (e.g. _1-(_2+_3) was evaluated as (_1-_2)+_3.
- Fixed placeholder expressions being evaluated as if unary operators take precedence over power operator (e.g. (-_1)^_2) was evaluated as -(_1^2)).
- Fixed vulnerable backtracking pattern in pl.stringx.strip (#275)
@julianguinard
Copy link

Any update on this issue? Being allowed to easily change the plugins priorities would be greatly appreciated, as it would allow us to avoid forking a plugin just to change the PRIORITY constant value. In my case I would set the rate-limiting plugin priority higher than basic-Auth for instance, as the Current order prevents rate limiting protection against password bruteforce attackers

@rucciva
Copy link
Contributor

rucciva commented May 9, 2020

Just wondering, if any change to the plugin order be made, is it also possible to have a plugin executed more than once? for example applying rate-limit to route and route+consumer, to make sure that the route will serve max 100 tps but a certain consumer can only get max 10 tps on that route. I'm also thinking that this will benefit scripting-like plugin, maybe when we need to add some generic processing to a route but add some custom processing for a certain consumer without losing the generic processing done on the route.

@julianguinard
Copy link

In the end I ended up with the following steps in order to adress this issue :

  • write a Dockerfile starting FROM kong:2.0.4 in which rate-limiting is copied as rate-limiting-1999-priority, and the latter's handler.lua has a RateLimitingHandler.PRIORITY = 1999 rather than 901, which is the initial priority for rate-limiting

  • run my kong containers using that forked image and passing them KONG_PLUGINS=bundled,rate-limiting-1999-priority environment variable

  • use rate-limiting-1999-priority, which runs directly after CORS plugin and before any Auth plugin, when I need to limit rates by IP, and original rate-limiting for others services/routes for which I want to limit by any other entity (consumer, credentual or service)

I will stay tuned for this issue in case there is a cleaner, config-driven way to do this

@ozonni
Copy link

ozonni commented Jan 22, 2021

this is insane that this issue is still opened after 6 years. I have very standard flow, i wanna rate limit based on header that i build in request transformation plugin. Is it really unique what i'm doing here? But i can't do that cause rate limiting happens before request transformation.

@Tieske
Copy link
Member

Tieske commented Mar 1, 2021

This request is, as simple as it might seem, a very complex one to implement. It is still on the radar however.

Meanwhile this can be used as a workaround: https://github.com/Kong/priority-updater

ping @brycehemme

@guanlan guanlan closed this as completed May 26, 2021
@Kong Kong locked and limited conversation to collaborators May 26, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
task/feature Requests for new features in Kong
Projects
None yet
Development

No branches or pull requests