-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Return HTTP 503 on ApiKey/Token endpoints if services are not enabled #51585
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
Comments
Pinging @elastic/es-security (:Security/Authentication) |
Do we already return So if we are returning Also |
With above being said, I do also reckon that by just looking at the short texts of the codes, |
I’m having a hard time seeing this as a 5xx. The client sent a request to a server that wasn’t configured to support the request. Is that a server error (we messed up)? I don’t think so. It’s a client/administrator error. When it comes to 501, it means that we don’t support the functionality, but that’s not right, it just wasn’t configured. It’s not that we’re incapable of performing the request, we’re not configured to perform the request. Also, this status code is cacheable, so even if an administrator fixes the issue, clients through some proxies could still error out. That seems bad. When it comes to 503, we abuse it a bit today, but it’s meant to be reserved for temporary service issues. That’s not the case here, as the administrator might elect to never enable functionality. I lean towards 4xx, that the client made an error. We have some prior art here in the use of 405 when a user sends a method that an endpoint doesn’t support. I don’t think that’s appropriate here, but only point it out to draw attention to the tension between 405 and 501 in terms of there being a client error indicating status code for “not implemented”. I think a generic 400 is appropriate. |
We discussed this and decided that (apart from the debate about the best status code), a status code was not really the best way to communicate this information. I have opened #52311 instead. |
See: elastic/kibana#55255
If the token service and api key services are disabled, then usage of those APIs will fail, but the only way to determine that it is caused by ES configuration is to parse the error message.
We would prefer not to have clients that depend on the error message.
From my reading of the spec, I think the
503
response status would be a reasonable fit for this failure case (I'd accept an argument for501
, but I think 503 is better).The text was updated successfully, but these errors were encountered: