0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LaravelでAccess-Control-Allow-Originエラー【CORS】

Posted at

CORSを設定しよう

php artisan config:publish cors
php artisan config:clear

すべてのリクエストに設定するには、config/cors.phpを変更してね

config/cors.php
// 変更前
'paths' => ['api/*', 'sanctum/csrf-cookie'],
// 変更後
'paths' => ['*', 'sanctum/csrf-cookie'],

エラー内容

Access to fetch at 'https://example.jp' from origin 'https://example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?