laravel - Laravel Cors error - URL has been blocked
问题描述
I tried to create authentication with cas but I ran into this problem. I placed my routes both in web.php
and in api.php
, but got the same result. Usually I use header permission and it works, but now it doesn't.
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers: Content-Type, X-Auth-Token,
Authorization, Origin'); header('Access-Control-Allow-Methods: POST, PUT');
Access to XMLHttpRequest at 'https://example/cas/login?service=http%3A%2F%2F127.0.0.1%3A8000%2Flookups' (redirected from 'http://127.0.0.1:8000/lookups') from origin 'http://127.0.0.1:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
解决方案
barryvdh /laravel-cors软件包有助于解决此错误,请在此处下载: