From 5e18486f29852c5a29d80f8839e0f3af20faa731 Mon Sep 17 00:00:00 2001 From: Mark van Eijk Date: Fri, 1 Dec 2023 12:36:08 +0100 Subject: [PATCH] wip --- src/Middleware/TrustCloudflareProxies.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Middleware/TrustCloudflareProxies.php b/src/Middleware/TrustCloudflareProxies.php index c02e358..f374ced 100644 --- a/src/Middleware/TrustCloudflareProxies.php +++ b/src/Middleware/TrustCloudflareProxies.php @@ -11,10 +11,13 @@ class TrustCloudflareProxies public function handle(Request $request, Closure $next) { $request->setTrustedProxies( - $this->getCachedProxies(), - Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PREFIX | Request::HEADER_X_FORWARDED_AWS_ELB + $this->getCachedProxies() ); + if (! app()->isLocal() && ! $request->secure()) { + return redirect()->secure($request->path()); + } + return $next($request); }