Closed eymen-elkum closed 7 years ago
I will add the possibility of not modifying exceptionRenderer.
But if you don't use exceptionRenderer see https://github.com/ozee31/cakephp-cors#errorcontroller to activate CORS if you have an exception
thanks @ozee31 i will follow that
Any chance we can get an example of how to disable the CORS exception renderer when using JsonApiListener (so I can update the blog so people won't have broken validation when following the tutorial.
It's released:
just change cors config in your app.php
like
'Cors' => [
'exceptionRenderer' => false
]
Thanks, didn't get that. I will update the blog accordingly. Good job 👍
Not working for me, I am not getting no JSON API errors and no validation errors. Anything I could be missing here?
Seems false
doesn't quite do it for Crud's JsonApiListener
. This however, does work:
'Cors' => [
'exceptionRenderer' => '\Crud\Error\JsonApiExceptionRenderer'
],
Hi @bravo-kernel I fixed it by using the deprecated header function in the error controller my PR for this may caused this problem
public function beforeRender(Event $event)
{
parent::beforeRender($event);
//$this->response->withHeader('Access-Control-Allow-Origin:', '*');
$this->response->header(['Access-Control-Allow-Origin' => '*']);
$this->viewBuilder()->setTemplatePath('Error');
}
hey guys, i have same error, how did you solved ?
In the case that crud' json api listener is using, the error cors Exception Rendered overrides Crud\Error\JsonApiExceptionRenderer
how can we fix this?