mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
fix: add middleware for TrustHosts/Proxies
This commit is contained in:
parent
3f4b887c6a
commit
6fc069eb91
3 changed files with 24 additions and 3 deletions
|
@ -14,8 +14,10 @@ use App\Http\Middleware\VerifyCsrfToken;
|
|||
use Illuminate\Auth\Middleware\Authorize;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance;
|
||||
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
|
||||
use Illuminate\Http\Middleware\HandleCors;
|
||||
use Illuminate\Http\Middleware\TrustProxies;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
|
@ -28,11 +30,13 @@ class Kernel extends HttpKernel
|
|||
* @var array<int,class-string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
CheckForMaintenanceMode::class,
|
||||
TrustHosts::class,
|
||||
TrustProxies::class,
|
||||
HandleCors::class,
|
||||
PreventRequestsDuringMaintenance::class,
|
||||
ValidatePostSize::class,
|
||||
TrimStrings::class,
|
||||
ForceHttps::class,
|
||||
TrustHosts::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ class TrustHosts extends IlluminateTrustHost
|
|||
public function hosts(): array
|
||||
{
|
||||
return [
|
||||
config('app.url'),
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
|
|
16
app/Http/Middleware/TrustProxies.php
Normal file
16
app/Http/Middleware/TrustProxies.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
* Setting this to '*' will trust all proxies, as we don't know the IP address of the proxy server.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $proxies = ['*'];
|
||||
}
|
Loading…
Reference in a new issue