-
Notifications
You must be signed in to change notification settings - Fork 336
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
Support POST and GET for application restart commands in control API #1445
Comments
I wonder how to use the API with POST method, any examples? |
It would be the same command, but a POST request
We're already using PUT when updating the configuration from a json file. |
For context, this is the logic that decides what method to let through: https://github.com/nginx/unit/blob/master/src/nxt_controller.c#L2309 |
@hongzhidao had an excellent idea on Monday about this: We could also support an endpoint where it’s not application specific, so instead of sending an empty (no body) POST to {
"command": "restart",
"applications": ["app1", "app2"]
} This might be a value add for Later™ |
Currently the control API's message to restart a specific application is a GET request per the documentation: https://unit.nginx.org/configuration/#configuration-proc-mgmt
Semantically a GET request should not change state or have side effect on the server. It's more appropriate to use a POST request for this, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
Unit version 1.34 should add support for POST requests for the same endpoints for restarts without removing support for GET requests.
We should also print a deprecation notice when folks are using GET request to issue a restart command to prepare them for its eventual removal in the following version tracked in #1446 .
The text was updated successfully, but these errors were encountered: