I am trying to return custom status codes using Kohana 3.1, like so :
$this->response->status(420);
Kohana says so :
“Kohana_Response::status unknown status value : 418”
How do I force Kohana to send such a status code?
FYI, the server I am using is Nginx, and I have to catch this status code there in Nginx.
If you check the source code to the
Response::status()method you will that Kohana has a whitelist of valid response codes.Either override the
Responseclass (using kohana’s transparent extension) and add your new status to the$messagesarray.Or, since it is a public property add the entry to
Response::$messagesinbootstrap.php.