laravel CORS
-
리액트에서 라라벨API 호출할때 CORS 문제카테고리 없음 2023. 7. 28. 16:12
아래 솔루션은 Laravel의 CORS 관련 문제를 해결해야 합니다. 1단계: 새 미들웨어 생성(Cors.php 파일) php artisan make:middleware Cors 2 단계: Cors.php 파일을 열어 handle function 을 아래와 같이 수정. public function handle($request, Closure $next) { return $next($request) ->header('Access-Control-Allow-Origin', '*') ->header('Access-Control-Allow-Methods', '*') ->header('Access-Control-Allow-Headers',' Origin, Content-Type, Accept, Authorizati..