CORS issues, image is uploading but not inserting into editor

77 views Asked by At

My frontend (react) is at 8001 port and serverside(laravel) at 8000. I've installed elfinder in laravel and CkEditor 4 in react. Integrating elfinder with Ckeditor is done, uploading works correct, but when trying to insert an image to ckeditor error is occured

Error in getFileCallback.
Blocked a frame with origin "http://localhost:8000" from accessing a cross-origin frame.

Trying with CustomCors in laravel doesn't work.

<?php    
namespace App\Http\Middleware;    
use Closure;    
class CustomCors
{
    public function handle($request, Closure $next)
    {
        $response = $next($request);    
        $response->headers->set('Access-Control-Allow-Origin', 'http://localhost:8001'); // Set your frontend URL here
        $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
        $response->headers->set('Access-Control-Allow-Headers', 'Content-Type, Authorization');    
        return $response;
    }
}

I think CORS is related to CkEditor instead of elfinder and Laravel.

0

There are 0 answers