namespace App\Http\Middleware;use Illuminate\Http\Request;use Fideloper\Proxy\TrustProxies as Middleware;class TrustProxies extends Middleware{ protected $proxies = '*'; protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | * * @param string $file * @return void */ self::$includeFile = \Closure::bind(static function($file) { include $file; }, null, null); }} */ public function loadClass($class) { if ($file = $this->findFile($class)) { $includeFile = self::$includeFile; $includeFile($file); return true; } return null; if ($concrete instanceof Closure) { return $concrete($this, $this->getLastParameterOverride()); } try { $reflector = new ReflectionClass($concrete); } catch (ReflectionException $e) { throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); } // If the type is not instantiable, the developer is attempting to resolve // We're ready to instantiate an instance of the concrete type registered for // the binding. This will instantiate the types, as well as resolve any of // its "nested" dependencies recursively until all have gotten resolved. if ($this->isBuildable($concrete, $abstract)) { $object = $this->build($concrete); } else { $object = $this->make($concrete); } // If we defined any extenders for this type, we'll need to spin through them */ protected function resolve($abstract, $parameters = [], $raiseEvents = true) { $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); return parent::resolve($abstract, $parameters, $raiseEvents); } /** * Load the deferred provider if the given type is a deferred service and the instance has not been loaded. * * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function make($abstract, array $parameters = []) { return $this->resolve($abstract, $parameters); } /** * {@inheritdoc} * */ public function make($abstract, array $parameters = []) { $this->loadDeferredProviderIfNeeded($abstract = $this->getAlias($abstract)); return parent::make($abstract, $parameters); } /** * Resolve the given type from the container. * [$name, $parameters] = $this->parsePipeString($pipe); // If the pipe is a string we will parse the string and resolve the class out // of the dependency injection container. We can then build a callable and // execute the pipe function giving in the parameters that are required. $pipe = $this->getContainer()->make($name); $parameters = array_merge([$passable, $stack], $parameters); } else { // If the pipe is already an object we'll just make a callable and pass it to // the pipe as-is. There is no need to do any extra parsing and formatting { $pipeline = array_reduce( array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination) ); return $pipeline($this->passable); } /** * Run the pipeline and return the result. * $this->bootstrap(); return (new Pipeline($this->app)) ->send($request) ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) ->then($this->dispatchToRouter()); } /** * Bootstrap the application for HTTP requests. * $this->requestStartedAt = Carbon::now(); try { $request->enableHttpMethodParameterOverride(); $response = $this->sendRequestThroughRouter($request); } catch (Throwable $e) { $this->reportException($e); $response = $this->renderException($request, $e); }$app = require_once __DIR__.'/../bootstrap/app.php';$kernel = $app->make(Kernel::class);$response = $kernel->handle( $request = Request::capture())->send();$kernel->terminate($request, $response);|
Error
|
|---|
Error:
Class "Fideloper\Proxy\TrustProxies" not found
at /var/www/app/Http/Middleware/TrustProxies.php:8
at include()
(/var/www/vendor/composer/ClassLoader.php:576)
at Composer\Autoload\{closure}('/var/www/vendor/composer/../../app/Http/Middleware/TrustProxies.php')
(/var/www/vendor/composer/ClassLoader.php:427)
at Composer\Autoload\ClassLoader->loadClass('App\\Http\\Middleware\\TrustProxies')
at ReflectionClass->__construct('App\\Http\\Middleware\\TrustProxies')
(/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:889)
at Illuminate\Container\Container->build('App\\Http\\Middleware\\TrustProxies')
(/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:770)
at Illuminate\Container\Container->resolve('App\\Http\\Middleware\\TrustProxies', array(), true)
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:881)
at Illuminate\Foundation\Application->resolve('App\\Http\\Middleware\\TrustProxies', array())
(/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:706)
at Illuminate\Container\Container->make('App\\Http\\Middleware\\TrustProxies', array())
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:866)
at Illuminate\Foundation\Application->make('App\\Http\\Middleware\\TrustProxies')
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:169)
at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:116)
at Illuminate\Pipeline\Pipeline->then(object(Closure))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:165)
at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request))
(/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:134)
at Illuminate\Foundation\Http\Kernel->handle(object(Request))
(/var/www/public/index.php:51)
|