fruitcake / laravel-cors

Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application
MIT License
6.27k stars 613 forks source link

Can't upload in centos when package is above 14M #529

Closed stridedot closed 3 years ago

stridedot commented 3 years ago

Enviroment

In local enviroment, upload package above 14M to remote OSS works very well,but in centos, it gave an exception:

TypeError: Argument 2 passed to Fruitcake\Cors\HandleCors::addHeaders() must be an instance of Symfony\Component\HttpFoundation\Response, null given, called in /data/php-api/cross_order/vendor/fruitcake/laravel-cors/src/HandleCors.php on line 63 in file /data/php-api/cross_order/vendor/fruitcake/laravel-cors/src/HandleCors.php on line 73

#0 /data/php-api/cross_order/vendor/fruitcake/laravel-cors/src/HandleCors.php(63): Fruitcake\Cors\HandleCors->addHeaders(Object(Illuminate\Http\Request), NULL)
#1 /data/php-api/cross_order/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#2 /data/php-api/cross_order/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#3 /data/php-api/cross_order/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#4 /data/php-api/cross_order/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#5 /data/php-api/cross_order/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#6 /data/php-api/cross_order/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#7 /data/php-api/cross_order/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#8 {main}

cors.php

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

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => [],

    'max_age' => 0,

    'supports_credentials' => false,
];

I don't know why it happens , can anyone help me? thank you

stridedot commented 3 years ago

I have solve it, I update upload_max_filesize and post_max_size in php.ini, and it solved my problem