ability to enable/disable an API #7238
Replies: 13 comments
-
this is risky. you might want to add some security protection to this action. |
Beta Was this translation helpful? Give feedback.
-
@sinzone Not really, anyone with access to this could just as well do a DELETE and cause the same outage. |
Beta Was this translation helpful? Give feedback.
-
whats the difference then from having ACL plugin activated on a specific API? |
Beta Was this translation helpful? Give feedback.
-
This operation deactivates the API immediately regardless of the plugins installed. |
Beta Was this translation helpful? Give feedback.
-
Is anyone working on this? If not I can create a pull request for one of the following two options.
My current work around is to create my API with a dummy upstream URL (e.g. http://localhost/error/503) and then after all the plugins are configured I change it to the real upstream url. |
Beta Was this translation helpful? Give feedback.
-
there are two things here;
available enabled Does this make sense? |
Beta Was this translation helpful? Give feedback.
-
That sounds reasonable.
I can work on a pull request if you'd like.
|
Beta Was this translation helpful? Give feedback.
-
a PR would be nice 👍 just for reference linking this to #1725 same, but on consumers. |
Beta Was this translation helpful? Give feedback.
-
I'm splitting this into a few PR's. The first Http Response 503 Service Unavailable just adds a new response code for 503 Service Unavailable. I wanted that separate to make sure I follow your committing process correctly before I do the next one which will be the api-unnailable plugin. Let me know if I missed anything or should do anything different. P. S. I did try and run the test suite but there seems to be some errors on the next branch. I did verify that this change didn't cause an error in normal operation of the server. |
Beta Was this translation helpful? Give feedback.
-
👍 another thought; maybe the plugin should be configurable as in "request termination" plugin, with a configurable statuscode and message. Those could then default to "503" and "Service unavailable". But would allow for another status/message. (but feel free to stick to just 503)
just to be clear; this cannot be a plugin, this is part of the core. |
Beta Was this translation helpful? Give feedback.
-
I was thinking along the same lines last night that it would be useful to be able to specify different status codes.
You're last comment about being part of the core.
For the enabled flag I was thinking that would be on the apis table and when the request is processed the api will be ignored by the core if enabled=false.
For the request termination (was originally suggested as api unavailable) plugin that would be a core plugin in the core kong source tree with a high priority that would send the configured status code and message.
|
Beta Was this translation helpful? Give feedback.
-
This was done in #2328, no? |
Beta Was this translation helpful? Give feedback.
-
Robert,
No that pull request was for a plugin that allowed you to send a alternate HTTP status code instead of forwarding the request.
The ability to disable an API was thought of at the same time. Except that disabling the API would skip it in the request processing. This allowing potentially another API to be matched. In effect it would be as if the API didn't exist but you could preserve the config if you wanted to enable it again. That could be useful in provisioning an API with a lot of plugins. Create it disabled, add the plugins then enable it.
|
Beta Was this translation helpful? Give feedback.
-
An use-case would be to quickly disable an API from being consumed.
Beta Was this translation helpful? Give feedback.
All reactions