when the backend proxy used in
auth_request returns an error code different from 401 or 403, nginx is returning a 500 error code.
The ngx_http_auth_request_module module (1.5.4+) implements client authorization based on the result of a subrequest. If the subrequest returns a 2xx response code, the access is allowed. If it returns 401 or 403, the access is denied with the corresponding error code. Any other response code returned by the subrequest is considered an error.
Is there a way to make nginx returns the status code from the backend and not 500 ?