Closed avinashjoshi closed 8 years ago
Sorry for the very slow reply. The way this tiny plugin works is through the DispatcherFactory functionality in CakePHP 3. Exception handling breaks out from that completely and does its own response rendering.
So you need to set the "Access-Control-Allow-[xxx]" headers when you create the exception yourself, e.g.
$e = new NotFoundException();
$e->responseHeader(['Access-Control-Allow-Origin' => '*']);
throw $e;
instead of just
throw new NotFoundException();
Or you can write your own exception handler http://book.cakephp.org/3.0/en/development/errors.html
I get the following error when throwing exceptions like
404
or401
or422
etcWorks perfectly on 200. Is there a way fix this?