Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

[Solution] Add exception handler cross domain for laravel 8.x #537

Open
CongAn opened this issue Jul 5, 2021 · 2 comments
Open

[Solution] Add exception handler cross domain for laravel 8.x #537

CongAn opened this issue Jul 5, 2021 · 2 comments

Comments

@CongAn
Copy link

CongAn commented Jul 5, 2021

Add the following code inapp/Exceptions/Handler.php to add cross domain support for all exception error responses in laravel 8. X project.

app/Exceptions/Handler.php 中添加以下代码,可以为laravel 8.x项目中所有异常错误响应添加跨域支持。

    public function render($request, Throwable $e)
    {
        return app('Fruitcake\Cors\HandleCors')
            ->handle($request, fn() => parent::render($request, $e));
    }

I'm very sorry, English is not good, it all depends on translation.

#32

@ex0nnix
Copy link

ex0nnix commented Jul 27, 2021

Add the following code inapp/Exceptions/Handler.php to add cross domain support for all exception error responses in laravel 8. X project.

app/Exceptions/Handler.php 中添加以下代码,可以为laravel 8.x项目中所有异常错误响应添加跨域支持。

    public function render($request, Throwable $e)
    {
        return app('Fruitcake\Cors\HandleCors')
            ->handle($request, fn() => parent::render($request, $e));
    }

I'm very sorry, English is not good, it all depends on translation.

#32

You saved my day.

@AntonLugtenburg
Copy link

Thanks buddy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants