diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index e18eb837..ac3a779d 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -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 */ protected $middleware = [ - CheckForMaintenanceMode::class, + TrustHosts::class, + TrustProxies::class, + HandleCors::class, + PreventRequestsDuringMaintenance::class, ValidatePostSize::class, TrimStrings::class, ForceHttps::class, - TrustHosts::class, ]; /** diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php index 85321dba..a8650b97 100644 --- a/app/Http/Middleware/TrustHosts.php +++ b/app/Http/Middleware/TrustHosts.php @@ -12,6 +12,7 @@ class TrustHosts extends IlluminateTrustHost public function hosts(): array { return [ + config('app.url'), $this->allSubdomainsOfApplicationUrl(), ]; } diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php new file mode 100644 index 00000000..dcaa42a6 --- /dev/null +++ b/app/Http/Middleware/TrustProxies.php @@ -0,0 +1,16 @@ + + */ + protected $proxies = ['*']; +}