Symfony Exception

MethodNotAllowedHttpException

HTTP 405 Method Not Allowed

The GET method is not supported for route /. Supported methods: OPTIONS.

Exception

Symfony\Component\HttpKernel\Exception\ MethodNotAllowedHttpException

Show exception properties
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException {#673
  -statusCode: 405
  -headers: array:1 [
    "Allow" => "OPTIONS"
  ]
}
  1. *
  2. * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
  3. */
  4. protected function requestMethodNotAllowed($request, array $others, $method)
  5. {
  6. throw new MethodNotAllowedHttpException(
  7. $others,
  8. sprintf(
  9. 'The %s method is not supported for route %s. Supported methods: %s.',
  10. $method,
  11. $request->path(),
  1. return (new Route('OPTIONS', $request->path(), function () use ($methods) {
  2. return new Response('', 200, ['Allow' => implode(',', $methods)]);
  3. }))->bind($request);
  4. }
  5. $this->requestMethodNotAllowed($request, $methods, $request->method());
  6. }
  7. /**
  8. * Throw a method not allowed HTTP exception.
  9. *
  1. // another HTTP verb. If it is we will need to throw a MethodNotAllowed and
  2. // inform the user agent of which HTTP verb it should use for this route.
  3. $others = $this->checkForAlternateVerbs($request);
  4. if (count($others) > 0) {
  5. return $this->getRouteForMethods($request, $others);
  6. }
  7. throw new NotFoundHttpException(sprintf(
  8. 'The route %s could not be found.',
  9. $request->path()
  1. // First, we will see if we can find a matching route for this current request
  2. // method. If we can, great, we can just return it so that it can be called
  3. // by the consumer. Otherwise we will check for routes with another verb.
  4. $route = $this->matchAgainstRoutes($routes, $request);
  5. return $this->handleMatchedRoute($request, $route);
  6. }
  7. /**
  8. * Get routes from the collection by method.
  9. *
  1. */
  2. protected function findRoute($request)
  3. {
  4. $this->events->dispatch(new Routing($request));
  5. $this->current = $route = $this->routes->match($request);
  6. $route->setContainer($this->container);
  7. $this->container->instance(Route::class, $route);
  1. * @param \Illuminate\Http\Request $request
  2. * @return \Symfony\Component\HttpFoundation\Response
  3. */
  4. public function dispatchToRoute(Request $request)
  5. {
  6. return $this->runRoute($request, $this->findRoute($request));
  7. }
  8. /**
  9. * Find the route matching a given request.
  10. *
  1. */
  2. public function dispatch(Request $request)
  3. {
  4. $this->currentRequest = $request;
  5. return $this->dispatchToRoute($request);
  6. }
  7. /**
  8. * Dispatch the request to a route and return the response.
  9. *
  1. protected function dispatchToRouter()
  2. {
  3. return function ($request) {
  4. $this->app->instance('request', $request);
  5. return $this->router->dispatch($request);
  6. };
  7. }
  8. /**
  9. * Call the terminate method on any terminable middleware.
in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php -> Illuminate\Foundation\Http\{closure} (line 141)
  1. */
  2. protected function prepareDestination(Closure $destination)
  3. {
  4. return function ($passable) use ($destination) {
  5. try {
  6. return $destination($passable);
  7. } catch (Throwable $e) {
  8. return $this->handleException($passable, $e);
  9. }
  10. };
  11. }
Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in /var/www/app/Http/Middleware/ContentSecurityPolicy.php (line 28)
  1. * - media : self + blob (webcam stream)
  2. * - workers : self + blob (TF.js WebWorkers)
  3. */
  4. public function handle(Request $request, Closure $next)
  5. {
  6. $response = $next($request);
  7. if (!method_exists($response, 'header')) {
  8. return $response;
  9. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. */
  2. public function handle($request, Closure $next)
  3. {
  4. $this->clean($request);
  5. return $next($request);
  6. }
  7. /**
  8. * Clean the request's data.
  9. *
  1. if ($callback($request)) {
  2. return $next($request);
  3. }
  4. }
  5. return parent::handle($request, $next);
  6. }
  7. /**
  8. * Transform the given value.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. */
  2. public function handle($request, Closure $next)
  3. {
  4. $this->clean($request);
  5. return $next($request);
  6. }
  7. /**
  8. * Clean the request's data.
  9. *
  1. if ($callback($request)) {
  2. return $next($request);
  3. }
  4. }
  5. return parent::handle($request, $next);
  6. }
  7. /**
  8. * Transform the given value.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. if ($max > 0 && $request->server('CONTENT_LENGTH') > $max) {
  2. throw new PostTooLargeException;
  3. }
  4. return $next($request);
  5. }
  6. /**
  7. * Determine the server 'post_max_size' as bytes.
  8. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. null,
  2. $this->getHeaders($data)
  3. );
  4. }
  5. return $next($request);
  6. }
  7. /**
  8. * Determine if the incoming request has a maintenance mode bypass cookie.
  9. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in /var/www/app/Http/Middleware/Cors.php (line 19)
  1. $res = response('', Response::HTTP_NO_CONTENT);
  2. $res->headers->set('Content-Type', 'application/json; charset=UTF-8');
  3. return $this->withCorsHeaders($res);
  4. }
  5. $response = $next($request);
  6. // 1. Aseguramos que TODAS las respuestas lleven CORS primero, pase lo que pase
  7. $response = $this->withCorsHeaders($response);
  8. // 2. Luego forzamos el JSON si aplica
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. * @return \Illuminate\Http\Response
  2. */
  3. public function handle($request, Closure $next)
  4. {
  5. if (! $this->hasMatchingPath($request)) {
  6. return $next($request);
  7. }
  8. $this->cors->setOptions($this->container['config']->get('cors', []));
  9. if ($this->cors->isPreflightRequest($request)) {
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. {
  2. $request::setTrustedProxies([], $this->getTrustedHeaderNames());
  3. $this->setTrustedProxyIpAddresses($request);
  4. return $next($request);
  5. }
  6. /**
  7. * Sets the trusted proxies on the request.
  8. *
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in /var/www/app/Http/Middleware/NormalizeGenericUser.php (line 25)
  1. if (isset($user->_id) && !isset($user->id)) {
  2. $user->id = $user->_id;
  3. }
  4. }
  5. return $next($request);
  6. }
  7. }
  1. // since the object we're given was already a fully instantiated object.
  2. $parameters = [$passable, $stack];
  3. }
  4. $carry = method_exists($pipe, $this->method)
  5. ? $pipe->{$this->method}(...$parameters)
  6. : $pipe(...$parameters);
  7. return $this->handleCarry($carry);
  8. } catch (Throwable $e) {
  9. return $this->handleException($passable, $e);
  1. {
  2. $pipeline = array_reduce(
  3. array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  4. );
  5. return $pipeline($this->passable);
  6. }
  7. /**
  8. * Run the pipeline and return the result.
  9. *
  1. $this->bootstrap();
  2. return (new Pipeline($this->app))
  3. ->send($request)
  4. ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
  5. ->then($this->dispatchToRouter());
  6. }
  7. /**
  8. * Bootstrap the application for HTTP requests.
  9. *
  1. $this->requestStartedAt = Carbon::now();
  2. try {
  3. $request->enableHttpMethodParameterOverride();
  4. $response = $this->sendRequestThroughRouter($request);
  5. } catch (Throwable $e) {
  6. $this->reportException($e);
  7. $response = $this->renderException($request, $e);
  8. }
Kernel->handle(object(Request)) in /var/www/public_html/index.php (line 80)
  1. $app = require_once __DIR__.'/../bootstrap/app.php';
  2. $kernel = $app->make(Kernel::class);
  3. $response = $kernel->handle(
  4. $request = Request::capture()
  5. )->send();
  6. $kernel->terminate($request, $response);
  1. // application without having installed a "real" web server software here.
  2. if ($uri !== '/' && file_exists($publicPath.$uri)) {
  3. return false;
  4. }
  5. require_once $publicPath.'/index.php';

Stack Trace

MethodNotAllowedHttpException
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException:
The GET method is not supported for route /. Supported methods: OPTIONS.

  at /var/www/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:122
  at Illuminate\Routing\AbstractRouteCollection->requestMethodNotAllowed(object(Request), array('OPTIONS'), 'GET')
     (/var/www/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:107)
  at Illuminate\Routing\AbstractRouteCollection->getRouteForMethods(object(Request), array('OPTIONS'))
     (/var/www/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:41)
  at Illuminate\Routing\AbstractRouteCollection->handleMatchedRoute(object(Request), null)
     (/var/www/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:162)
  at Illuminate\Routing\RouteCollection->match(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:753)
  at Illuminate\Routing\Router->findRoute(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:740)
  at Illuminate\Routing\Router->dispatchToRoute(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:729)
  at Illuminate\Routing\Router->dispatch(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:190)
  at Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:141)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/app/Http/Middleware/ContentSecurityPolicy.php:28)
  at App\Http\Middleware\ContentSecurityPolicy->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
  at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31)
  at Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
  at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40)
  at Illuminate\Foundation\Http\Middleware\TrimStrings->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)
  at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:86)
  at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/app/Http/Middleware/Cors.php:19)
  at App\Http\Middleware\Cors->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:49)
  at Illuminate\Http\Middleware\HandleCors->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39)
  at Illuminate\Http\Middleware\TrustProxies->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/var/www/app/Http/Middleware/NormalizeGenericUser.php:25)
  at App\Http\Middleware\NormalizeGenericUser->handle(object(Request), object(Closure))
     (/var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180)
  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_html/index.php:80)
  at require_once('/var/www/public_html/index.php')
     (/var/www/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php:16)