I have 2 projects using Laravel 9 and vue js 3, Homepage and Adminpage, What I want to do is to display an image from the homepage in the adminpage, but It got Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/html. See for more details, So the image doesn't reload properly.

I have tried adding

crossOrigin = anonymous

in the img tag but it still no help.

I have also created the cors in my middleware, like this

public function handle($request, Closure $next)
    {
        return $next($request)
        ->header('Access-Control-Allow-Origin', '*')
        ->header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS')
        ->header('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, X-Token-Auth, Authorization');
    }

And register it in kernel.php

protected $middleware = [
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        \Illuminate\Http\Middleware\HandleCors::class,
        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \App\Http\Middleware\CorsMiddleware::class,
    ];

What should I do to bypass this ?

0

There are 0 best solutions below