Specify HTTP error status code from resolution program
Any error in resolution (ResolveByProcess
) by a program currently implicitly leads to a 500 Internal Server Error status code.
Instead, programs should have the ability to determine their own response code, e.g. 403 if the user is forbidden or 503 if a backing storage is unavailable.
There are several mechanisms under consideration:
-
As part of the parameters of the
ResolveByProcess
directive, a mapping from exit code of the process to status code of the response is given. For example asexit_code_map=1:403;2:503
which would map exit code 1 to status code 403, etc. Any over exit code would result in a 500. -
The primary result of the process is the data it writes to stdout. Through a special exit code, this data could be interpreted as the HTTP status code. This exit code can be configured via a parameter of the
ResolveByProcess
directive. Through a multi-value (#6) result, further information could be returned, for example a user-facing error message and HTTP-error specific header values such as Retry-After.
Further questions:
- Should all status code be allowed? Under all circumstances (stages, resolution mechanisms, ...)?