Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在生产服务器上使用Laravel 7时出现CORS策略错误_Php_Laravel_Cors - Fatal编程技术网

Php 在生产服务器上使用Laravel 7时出现CORS策略错误

Php 在生产服务器上使用Laravel 7时出现CORS策略错误,php,laravel,cors,Php,Laravel,Cors,我在拉威尔7号上,我发现了错误 Access to XMLHttpRequest at 'https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/lmvworker.min.js' from origin 'https://my.site.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value '

我在拉威尔7号上,我发现了错误

Access to XMLHttpRequest at 'https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/lmvworker.min.js' from origin 'https://my.site.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://127.0.0.1:8000' that is not equal to the supplied origin.
它在本地主机上工作,但当我在生产服务器上运行时,就会出现错误

我不明白为什么“访问控制允许来源”标题设置为http://127.0.0.1:8000'当在生产服务器上时

这是我的config/cors.php,我也尝试了“路径”=>['*']

'paths' => [],

'allowed_methods' => ['*'],

'allowed_origins' => ['*'],

'allowed_origins_patterns' => [],

'allowed_headers' => ['*'],

'exposed_headers' => false,

'max_age' => false,

'supports_credentials' => false,
Http/Kernel.php

config/app.php


注意:对于允许的_原点,在不使用通配符时,必须包含该方案,例如[…]http://example.com', 'https://example.com']. 您还必须考虑到,在使用允许的\u模式时,方案将存在


参考资料:

也许您正在手动将访问控制允许原点设置为http://127.0.0.1:8000 在其他地方,这个中间件没有运行。尝试在生产中搜索代码库以查找http://127.0.0.1:8000.i 已经做了,但没有发现任何我尝试过的“允许的来源”=>https://my.site.com“],但它不起作用
protected $middleware = [
    \Fruitcake\Cors\HandleCors::class,
    \App\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,
    \App\Http\Middleware\SetLocale::class
];
'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    ...
    ...
    Fruitcake\Cors\CorsServiceProvider::class
],