HTTP status code for server configuration problem
Asked Answered
C

0

7

HTTP status code 500 is used for "Internal Server Error"s, but it's very generic.

What status code is used by applications/proxies when they detect that a configuration problem prevents them (or a part of them) from working?

Neither RFC 2616 nor RFC 7231 define such a code, but maybe some unofficial status code is used somewhere already.


Example: A web application has an e-mail sending feature. The application works fine if the SMTP configuration is missing, but when trying to send an email, it will fail. It can detect that the configuration is missing/wrong.

Chevalier answered 28/7, 2021 at 11:27 Comment(5)
Could you give an example? If the server is misconfigured can it even start, let alone respond to requests?Katerine
who is using your api? if it's your own application, use whatever 5xx which doesn't have a particular meaning yet. other than that 500 is fine, because if you use any "unofficial" (if there is any) no standard library will know how to interpret that anyway, and just use a standard 500 fallback.Derk
Have you reached into a solution for this? I've a similar problem to solve. Got an endpoint like "GET /resource/sub-resource". There are many other sub-resources for this resource and respective end-points too, that all working fine. But server can't process this particular endpoint on "sub-resource" if there is a specific server-side configuration missing for the "resource". So, I felt it's not a 4XX error(so not a 400 or 422), and leaning more towards 5XX. Any thoughts?Flatiron
An after thought to my previous message: Probably it's still a 422 error, because this server anyway does not control that external system configuration, but only consumes. So, it's not the problem with this server. So, it can just let know the client, it can't process it until the external configuration issue is fixed(it does not know who can fix it). So, even a 400 error with a clear message might help on this.Flatiron
4xx means the client made an error and can correct it. Server config problems cannot be corrected by the client.Chevalier

© 2022 - 2024 — McMap. All rights reserved.