mirror of
https://github.com/koel/koel
synced 2024-11-24 13:13:05 +00:00
21 lines
436 B
PHP
21 lines
436 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Middleware;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Http\Request;
|
||
|
use Illuminate\Support\Facades\URL;
|
||
|
|
||
|
class ForceHttps
|
||
|
{
|
||
|
public function handle(Request $request, Closure $next)
|
||
|
{
|
||
|
if (config('koel.force_https')) {
|
||
|
URL::forceScheme('https');
|
||
|
$request->setTrustedProxies([$request->getClientIp()], Request::HEADER_X_FORWARDED_ALL);
|
||
|
}
|
||
|
|
||
|
return $next($request);
|
||
|
}
|
||
|
}
|