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); }