Suddenly getting the following alarm
Cross-Origin Read Blocking (CORB) blocked cross-origin response http://traxit-backend.test/api/register with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
Failed to load http://traxit-backend.test/api/register : Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' http://localhost:8080 ' is therefore not allowed access.
OPTIONS http://traxit-backend.test/api/register 500 (Internal Server Error)
It's been working fine with my configuration but just started acting up today. Im not sure if i need to do something. Tried different things I've read about on the internet with no luck
kernal.php file
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Barryvdh\Cors\HandleCors::class,
];
cors.php file
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedOriginsPatterns' => [],
'allowedHeaders' => ['*'],
'allowedMethods' => ['*'],
'exposedHeaders' => [],
'maxAge' => 0,
];
im using vuejs with axios on my front end. using laravel passport for access tokens.
added 'allowedHeaders' => ['Access-Control-Allow-Origin', '*'],
Not sure what changed, but it fixed it
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedOriginsPatterns' => [],
'allowedHeaders' => ['Access-Control-Allow-Origin', '*'],
'allowedMethods' => ['*'],
'exposedHeaders' => [],
'maxAge' => 0,
];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.