laravel 阻止的跨域请求:同源策略不允许阅读**处的远程资源

jpfvwuh4  于 2023-04-07  发布在  其他
关注(0)|答案(1)|浏览(200)

因此,我目前面临这个错误时,尝试运行我的前端域
//阻止跨域请求:同源策略不允许读取//处的远程资源
我有一个应用程序,是建立与nuxt的前端和laravel的后端。我如何添加前端域是否有一个特定的文件可用?,到laravel,以允许我的前端访问它的资源。
我正在使用水果蛋糕laravel,为cors配置,但我面临着同样的错误,我甚至试图在nginx文件中添加头配置

fivyi3re

fivyi3re1#

也许你可以检查config/cors.php:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Cross-Origin Resource Sharing (CORS) Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may configure your settings for cross-origin resource sharing
    | or "CORS". This determines what cross-origin operations may execute
    | in web browsers. You are free to adjust these settings as needed.
    |
    | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
    |
    */

    'paths' => ['api/*', 'sanctum/csrf-cookie'],

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => [],

    'max_age' => 0,

    'supports_credentials' => false,

];

或尝试再次检查您的nuxt

相关问题